IF statement help
Oliver Marshall
Oliver.Marshall at g2support.com
Wed Nov 11 16:57:35 UTC 2009
Hi chaps,
Can you help me with an if statement?
I have the following which checks for the existence of a folder ($1) in two locations ($folder1_source and $folder2_source). First it checks in the $folder1_source location then in the $ folder2_source location. If it finds it in neither then the $folder_source variable remains empty and the script quits.
****************
folder_source=""
if [ -d /$folder1_source/$1 ]; then
folder_source=1
elif [ -d /$folder2_source/$1 ]; then
folder_source=2
elif [ $folder_source="" ]; then
exit
fi
*****************
I want to add one more check which is that if the directory specified by the $1 variable is found in BOTH the /$folder1_source AND /$folder2_source locations then I want the script to fail.
Whats the best way of writing that last elif statement?
Olly
--
G2 Support
Network Support : Online Backups : Server Management
[cid:image001.jpg at 01CA62EE.B8276B10]
Tel: 0845 307 3443
Email: oliver.marshall at g2support.com<mailto:oliver.marshall at g2support.com>
Web: http://www.g2support.com<http://www.g2support.com/>
Twitter: g2support<http://twitter.com/home?status=@g2support>
Newsletter: http://www.g2support.com/newsletter
Mail: 2nd Floor, 130a Western Rd, Brighton, Sussex, BN12LA
G2 Support LLP is registered at Mill House, 103 Holmes Avenue, HOVE
BN3 7LE. Our registered company number is OC316341.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20091111/a53d3bc1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1969 bytes
Desc: image001.jpg
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20091111/a53d3bc1/attachment.jpg>
More information about the ubuntu-users
mailing list