Ubuntu Breezy 5.10 (don't suggest an upgrade - it works!)
I'm trying to set up a script which updates some software on the hard drive from a directory on a USB Flash drive.
After I've plugged in the USB drive and seen it recognised by automount:
ls -l /vol/USBDISKB
OK - shows me the directory and files.
#!/bin/bash if [ -d /vol/USBDISKB ]; then echo "Found USB drive" else echo "Not found: USB drive!" fi
doesn't see the USB drive. :-((
P.S. I tried to edit so it looks like code. Really.
18/04/10 08:54 GMT Well! I don't know are am pretty stupid but I don't seem able to add a comment in response. All I seem able to do is edit my original post :(
The obvious typos you can put down to my newbieness.
If you are interested on following this question there has developed a much bigger thread here:
answered 16 Apr '10, 12:50
There should be a semicolon before the else.
This works in my rig
answered 17 Apr '10, 16:38
The script you've got here won't work because it is missing semi-colons, as another poster suggested:
If you are going to put it into a script and not run it from the command line, then you can break it up so it is easier to read:
Note that this way, you don't need to include the semi-colons, because multiple commands aren't on the same line.
answered 18 Apr '10, 03:16
You can enter a multiline command at the shell prompt. The shell will prompt with $PS2 until the command is complete:
The '!' in double quotes might cause a problem due to the ridiculous practice of using a printing character for something other than printing the character. I prevent it by setting $histchars to the emptry string in ~/.bashrc
Does it have to be a bash script? Maybe a PERL script would work better?
answered 17 Apr '10, 03:29
i think try while condition is the best for your case
answered 22 Apr '10, 07:19
Most of the above examples don't work, because of the !
It seems that putting the ! in quotes gives it a special meening, but outside of quotes is a regular charecter. (that seems backwards, maybe I am going mad)
answered 04 May '11, 12:04
Why not just upgrade to the latest LTS version, 10.04.2LTS?
answered 05 May '11, 10:07
There are a couple of solutions to the exclamation mark:
For some strange reason, bash will not delete a backslash that quotes the exclamation mark when inside double quotes.
answered 02 Mar '13, 19:57
Are you sure /vol/USBDISKB is the mountpoint? Try this to see:
Another option is to use the mountpoint command instead of brackets:
answered 07 Nov '13, 07:05