I agree that's overkill. What is the the first line of the script? Does it contain a shebang line (e.g. #!/path/to/bash)? If so, is it pointing to the correct location of your bash shell?
What directory are you in when you run the command? Is another/directory a subdirectory of your current directory, or is it located in /?
The first line is #!/usr/bin/gawk -f, which works fine executing within the current directory. Hope to execute files that are in either a subdirectory or outside the current directory (which may require the full path from / ).
It looks like there is a bit of confusion with absolute addressing and relative addressing.
/another/directory/script
is absolute addressing (where script is in directory which is in another - a directory on /)
./another/directory/script is the same as
another/directory/script which is the same as
$PWD/another/directory/script
is relative addressing, ie relative to the current directory (and can be several directories 'below' /)
To find the script script in a sub-directory somewhere 'below' the current working directory and give it its full path, you can use:
my_script=`find $PWD -name "script" -print`
PHV, your suggestion is closest to my ideal. Given that parentheses around a command starts a subshell, maybe one ought to include ";exit" near the end.
Edcrosbys, after the first line in the script it is just a typical gawk script with: BEGIN { ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.