Solved

Shell Script help

I'm creating some disc images using cdrdao and I want to put it into a shell script so that it'll ask me for the output path/file, this way I can just run the program do a little input and let it do its thing. I would assume I would use the read command, but I'm horrible at anything even remotely close to programming.
2 answers Last reply Best Answer
More about shell script help
  1. Best answer
    Are you wanting to input just one file name or many? If just one the easiest approach would be to give it as a parameter to the script file and access it via the variable $1. So your comand line would be something like:

    process outputfilename

    and then inside the script $1 will have the value of outputfilename.

    If you need to enter a number of filenames one after the other, then the read function would be a better option. Again, fairly straightforward; in the script a line like:

    read filename

    would put the filename entered into the variable $filename. Have a look at this link for more details, and for information about shell programming in general.
  2. Best answer selected by horrormaster.
Ask a new question

Read More

Shell Script Programming Command Prompt