Shell execute multiple commands in one script

Hi,

The question may be dumb, but I just start my journey of learning.
How do I put these lines of command to one executable script and have it execute properly? By properly I mean each of the commands gets executed interdependently. I tried attaching ;, &&, & to the end of lines, none of them works as I wish. If I don't attach anything at end of lines, only the first line is executed.

exec /usr/local/bin/sudo sshfs -o allow_other,default_permissions user1@192.168.1.254:/jails/samba/store1 ~/smb_store1
exec /usr/local/bin/sudo sshfs -o allow_other,default_permissions user1@192.168.1.254:/jails/samba/store2 ~/smb_store2
exec /usr/local/bin/sudo sshfs -o allow_other,default_permissions user1@192.168.1.254:/jails/samba/store3 ~/smb_store3

Thanks.
 
exec(1) passes control to whatever you're starting, there is NO return from this.

Code:
exec [command [arg ...]]
	       Unless command is omitted, the shell process is	replaced  with
	       the  specified  program	(which	must  be a real	program, not a
	       shell built-in command or function).  Any redirections  on  the
	       exec  command are marked	as permanent, so that they are not un-
	       done when the exec command finishes.
sh(1)
 
put the sshfs commands in a shell script and sudo that script
or read password from the shell script and use echo $pass|sudo -S ....
 
Using sshfs is convinient, but I observe file transfer speed under sshfs is slow, compared with copying files between samba share mounted via smbnetfs and local.
 
Back
Top