[SLE] Re: Testing using Bash for an unknown extension

From: Sean Rima (sean_at_tcob1.net)
Date: 11/30/03

  • Next message: Sean Rima: "[SLE] Re: defrag for linux-answered at TLDP"
    To: suse-linux-e@suse.com
    Date: Sun, 30 Nov 2003 16:02:18 +0000
    
    
    

    Jerry Feldman writes:

    >> > I am trying to test to see if a file exsides but the extension
    >> > changes all the time, ie
    >> >
    >> > ab251455.001
    >> > ab251455.002
    >> >
    >> > if I do a :
    >> > if [ -e /var/max/spool/inbound/ab251455.* ] ; then
    >> > run_command
    >> > fi
    >> >
    >> > the run_command never runs
    >> >
    >>
    >> That's strange. I tried with
    >> #!/bin/bash
    >> if [ -e ab123.* ] ; then
    >> echo "It exists"
    >> fi
    >> and it works perfectly. Is run_command in the path?
    > You might be a bit better off using the for command.
    > #!/bin/bash
    > if [ -e /var/max/spool/inbound/ab251455.* ] ; then
    > LIST=$(ls /var/max/spool/inbound/ab251455.*)
    > for i in $LIST
    > do
    > runcommand $i
    > done
    > fi
    > - ----------------
    > This will allow you to issue your command on the individual file.
    >

    I cannot get it to work if there is a path in the test line otherwise this
    is perfect for something I need to do :)

    Sean

    
    



  • Next message: Sean Rima: "[SLE] Re: defrag for linux-answered at TLDP"

    Relevant Pages

    • Re: ksh on aix5.2 ml03 - strange read results
      ... ksh on aix5.2 ml03 - strange read results ... JOSEPH KREMBLAS a écrit: ... > command looks at IFS to make decisions as to the input file separator. ... > user adm has no .kshrc ...
      (AIX-L)
    • Re: Strange cjson bug doesnt occur in Pydb
      ... Emacs' Pydb. ... and hope that this strange difference between Pydb and the ... shell command line may be a clue to that. ... In my experience, however, the root cause of a segfault is often ...
      (comp.lang.python)
    • Re: Probs burning CDs
      ... >> I tried it also as root, ... What also is strange is the fact that I say ... If you set the program with suid you should be able to burn from the command ... I dont know why your cd burning stopped working and suddenly started ...
      (alt.os.linux.suse)
    • Re: Problem: Linux 2.6 running in vmware
      ... >> It is multiple executables segfaulting. ... Wouldn't it be strange for the problems only to affect ... There is a syntax error in the command. ...
      (comp.os.linux.development.system)
    • Re: TK scope "cant read . . . no such variable"
      ... to be used in strange situations ... immediate side-effect). ... would break your command. ... Now we are back to which execute a command immediately, ...
      (comp.lang.tcl)