Say I want to use the name of a file as input, and process it with a pre-made script in a certain directory. How do I do it?
fileName < /folder1/scriptName
is this the right format?
Say I want to use the name of a file as input, and process it with a pre-made script in a certain directory. How do I do it?
is this the right format? |
||||
You need to pass the name of the file as a parameter to the script
Then this is how you will call the script
This will be the output for the script
|
|||
|
These are some of the tests I executed:
Then executed,
It will print the contents of the file. This is a very basic example and the input is used only in one place. If you are processing the input in more than one place, which is usually the case when you write a script, then you will have to use the answer given by Fazle. Hope this helps. |
|||
|
./path/to/script < file_name
. – user2555595 Sep 28 '14 at 5:42