What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this, please help!
The first line of a script should be the shebang #! which it says what program is supposed to run the script when you make the file executable and run it as ./script.sh
However the script can be run as: ksh script.sh
If you remove the shebang that's the only option you have.
Anything that starts with just a # (except the #!, when is the first line) will be ignored as commands. They are just human readable comments.
I am assuming that the following does not exist in your actual script, since that will be incorrect.
Note that your #!bin/ksh should be #!/bin/ksh if your ksh shell lives there.
Hi,
Is there any way to extract function headers from c and c++ files using a shell script? I tried to do it by reading the C/C++ file line by line and if a line matches a particular pattern (pattern of function header) i extracted it otherwise moved to next line. The problem here is, some... (3 Replies)
The question is here:
http://farm9.staticflickr.com/8065/8217767191_2154e64904_b.jpg
My problem is that when I made up a non-existing directory, it prints out "hiii". It didn't enter the first if statement. It works if my directory exist.
My Work:
for fileOrDirectory in $* # all... (1 Reply)
1. The problem statement, all variables and given/known data:
My problem is that when I made up a non-existing directory, it prints out "hiii". It didn't enter the first if statement. It works if my directory exist.
2. Relevant notes:
The question is here:... (3 Replies)
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Hi Team -
I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n?
%~n is a DOS variable that dispayed the script name.
For instance (in DOS):
REM... (11 Replies)
Hi everyone,
I need to write a script to search a directory, output the name of a file to an ouput file and print the last few lines of the files to the output file such that I would have something like this:
FILE1:
LINE
LINE
LINE
FILE2:
LINE
LINE
LINE
FILE3:
LINE
LINE
LINE... (2 Replies)
I have a script, which is checking if file exists and move it to another directory
if
then
mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly
mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly
... (9 Replies)
I want to make a config file which contain all the paths.
i want to read the config file line by line and pass as an argument on my below function.
Replace all the path with reading config path line by line and pass in respective functions.
how can i achieve that?
Kindly guide.
... (6 Replies)