Re: optional exit statment in shell script



rudra wrote:
ere is an easier version of what i want to do


#!/bin/bash
echo "Enter file name"
echo "You can enter maximum 3 file"

for (( i=1; i<=3;i++))
until [ "$*" = "" ]
do
echo "Enter file ${i}"
read fil_$i

# check whether read actuylly read something and break if it didn't
[ -z $fil_$i ] && break
# untested...

done
//do the rest of the code

the probleam is, my input needs three input. but what i want to do is
to put an optin of optional break, say instead of three, i have only
one input ...so, if i put "0", the code should ixit for loop and do
the rest of the things.
how can i do that?

Bye, Jojo


.



Relevant Pages

  • Re: optional exit statement
    ... echo "You can enter maximum 3 file" ... to put an optin of optional break, say instead of three, i have only ... one input ...so, if i put "0", the code should ixit for loop and do ... Break with empty input: ...
    (comp.unix.shell)
  • Re: optional exit statement
    ... echo "You can enter maximum 3 file" ... to put an optin of optional break, say instead of three, i have only ... If your filenames do not have spaces you can try just: ... Use space or tab as separator and enter to finish ...
    (comp.unix.shell)
  • optional exit statement
    ... echo "You can enter maximum 3 file" ... to put an optin of optional break, say instead of three, i have only ... one input ...so, if i put "0", the code should ixit for loop and do ...
    (comp.unix.shell)
  • Re: Reading a variable line by line with while loop
    ... done < `echo "$Variable"` ... echo "History - $History" ... The last echo command returns nothing, but if I put an echo command in ... the loop either before, or after the replace spaces command, it echoes ...
    (Ubuntu)
  • Re: 2.6.16-rc4: known regressions
    ... either with a command line argument, or with just the early bootup initrd ... Is there a way to tell the kernel about which is the root device other ... a loop with one second delay. ... echo -n "Waiting for root device to appear" ...
    (Linux-Kernel)