Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make "Batch File" in LINUX

Status
Not open for further replies.

mrcrabs

MIS
May 27, 2005
4
US
I am normally a DOS/Windows man who is just now learning LINUX. I am discovering that every time I reboot a LINUX PC I have to remount my network drives. It can be a lot of trouble to properly mount a drive, especially if you make a typo or get the syntax wrong. If I were in DOS, I would simply create Batch Files to mount the drives. I would like to do something like this in LINUX so I could simply run something like "mountthisdrive" or "mountthatdrive" and make things a lot easier. How do I do this with SUSE LINUX?
 
It's very simple: just put your commands into a file, make it executable and (optionally) put it somewhere in your PATH.

So (see for longer version with more details):

echo "mount /dev/hbb1 /mydrv" > /usr/local/bin/mymounter
echo "mount /dev/hdb2 /mydrv2" >> /usr/local/bin/mymounter
chmod 700 /usr/local/bin/mymounter

(note the ">>" on the second command)

BUT: For mounting drives, you could also add the devices to /etc/fstab for automatic mounting..

Tony Lawrence
Linux/Unix/Mac OS X Resources
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top