I have the following question about UNIX:
What else is needed when the top line goes
#!\bin\awk -f
to make it run as a command?
I am thinking whatever the name of the script is it need to be given permission using chmod to make it run.
I have the following question about UNIX:
What else is needed when the top line goes
#!\bin\awk -f
to make it run as a command?
I am thinking whatever the name of the script is it need to be given permission using chmod to make it run.
The first line with the "#!" will be a full pathname to the program to be executed.
Pathnames in Linux have the forward slash between directories.
i.e.:
#!/bin/awk -f
or
#!/bin/bash
or
#!/usr/bin/perl
The first script would be run the script program using awk
, the second using bash
, the third using perl
.
You'll also have to make the file executable with:
$ chmod +x myscript.sh
#!\bin\awk -f
is a valid shebang line, but it isn't a useful one. It declares that the file must be interpreted by the program called \bin\awk
in the current directory. Thus, to answer the question literally, there are two ways to run that file as a command:
Create a file called \bin\awk
in the current directory, presumably by copying or linking some version of awk. Also, the script needs to be made executable.
ln -s /bin/awk '\bin\awk'
chmod +x /path/to/script
/path/to/script
Invoke awk explicitly.
awk -f /path/to/script
If modifying the file is allowed, then the shebang line should be edited to make sense: replace the backslashes by slashes. And make the file executable (which is undoubtedly the intended answer, but merely doing that would not be a correct answer).
\
for/
. – juanchopanza Oct 05 '14 at 17:56