i write a following shell script to mount attached usb drives. when i run it it runs only su - command. it ask for type password. but didn't run the other commands.what can i do to run other commands? please help me

su-
mkdir /mnt/Usb
mount -t vfat /dev/sdb1 /mnt/Usb

Recommended Answers

usb drives automount themselves rite? (unless you are using a min ver of linux)

Jump to Post

All 3 Replies

usb drives automount themselves rite? (unless you are using a min ver of linux)

can't the privious file system is creshed ......

A little late but I used to trip on this myself years ago.

Like 'sh' and 'bash', 'su' starts a new shell. You have to pass your commands to that new shell.

su -c "mkdir -p /mnt/Usb; mount /dev/sdb1 /mnt/Usb" root

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.