Going LOOPY on a Friday - Script Help Plz
Hi all,
I seem to of forgotten all basic shell scripting today and cant kickstart my brain so I am asking for some help. Here is what I am attempting to do: Quote:
Quote:
|
Seems a little homeworky :) ... what do you have so far ?
|
What is the context of this? The way you describe it, it looks like a cut and paste homework question, but your posting history suggests not.
The basic drill involves the "read" command. Try this in a terminal: Code:
while true; do read -p "enter word: " word; echo "you entered $word"; if [ $word == stop ]; then break; fi; done To write it in a script: Code:
while true; do |
LOL
His pretext indicates he's been denied before... |
Ah well... here's my 10 minute work of brilliance:
------------------------------------------------ #!/bin/bash echo -n "How many files would you like to process? " read COUNT for instance in $(seq 1 1 $COUNT) do echo -n "File ($instance) name: " read names[$instance] done for instance in $(seq 1 1 $COUNT) do echo "Processing file ${names[$instance]} ..." echo "doing shite here..." done ------------------------------------------------ cheers, kbp |
Reading it back, it does sound like a homeworky type question doesnt it! LOL
To be honest it's me not being able to think today (brain shut down at the end of a hard week) and I just thought you chaps could put me in the right direction. If it violates any of your "helping" rules then I will just tackle it next week. Its cool :) |
To affirm my brain cells...
Good job brain cells! Good job! Code:
#!/bin/bash |
All times are GMT -5. The time now is 02:14 PM. |