LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   bash scripting/batch file type thing (https://www.linuxquestions.org/questions/linux-general-1/bash-scripting-batch-file-type-thing-648/)

antken 01-22-2001 06:04 AM

just me again,
i have set up a small linux mandrake box to act as a cd server basicly you put cd in type a command and it makes an ISO file type a nother command and its mounted as a loop back device.
what i would like to do if its possible
is to either create a batch file that will automate this process, or make linux pickup a new cd in the drive readit in to an iso file and mount it as a loop back device.
i have got the commands from the cdserver howto
for the batch type method i would like to do somthing like:

readcd2iso *iso path and name*

mntiso *iso path and name* *mount point*

on ms windoze and dos in the batch file you just use %1 for the first word %2 for the second and so on like so hello.bat %1 %2 %3
on the command line you use your prams in place of the %1 %2
is it the same in linux?
and if anybody knows how would you make linux sense a cd in the drive and perform those above commands and eject the cd

any help or insight will be appreciated
thanks



chay 01-22-2001 07:39 AM

bash ...
 
#!/bin/bash
# ksh, sh & bash compatible, in this shells (and others)
# parameters are $1 $2 ... and so on, when you reach the
# 10th parameter it will work with ${10}, ${11}, ... etc

# Add your validations here
readcd2iso $1
mntiso $1 $2
echo "Pronto!"

antken 01-22-2001 07:56 AM

thanks that work great!
 
Thanks thats great

can i use ' if ' statements?

like if $1 = "" then
echo OOPS!
else echo OKAY!
thanks




All times are GMT -5. The time now is 09:00 AM.