in reply to perl callable from bash?
IMO you have problem with arguments only, and might be some problems with the absolute path of the first and second script(as other monks mentioned)../check.sh: line 3: firstscript: command not found ./check.sh: line 4: secondscript: command not found
and more of this can be seen in your shell manual(the above operators are from bash manual), use those effectively to figure out whether the file exists and continue only in such case. For the script use-e file True if file exists. -f file True if file exists and is a regular file. -r file True if file exists and is readable. -s file True if file exists and has a size greater than zero. -O file True if file exists and is owned by the effective user i +d. -G file True if file exists and is owned by the effective group +id.
before calling it from your shell script.-x file True if file exists and is executable.
if I write your script (shown in OP), in bash, it will be like
Hope this helps.#!/bin/bash echo -e "received arguments >$*<" filename=$1; script1='fristscript'; # use absolute path script2='firstscript'; # use absolute path if [ -f $filename ] ; then echo -e "executing scripts $script1, $script2"; if [ -x $script1 ]; then echo -e "executing $script1..." $script1 $filename else echo -e "$script1 not found"; fi if [ -x $script2 ]; then echo -e "executing $script2..." $script2 $filename else echo -e "$script2 not found"; fi else echo -e "$filename is not readable or doesn't exist"; fi
|
|---|