Active Topics

 


Reply
Thread Tools
Posts: 1 | Thanked: 0 times | Joined on Jul 2013
#1
#!/bin/sh
if [ -f /bin/bash ]
then
echo “file /bin/bash exists”
fi
if [ -d /bin/bash ]
then
echo “/bin/bash is a directory”
else
echo “/bin/bash is NOT a directory”

I WANT TO KNOW THE DESCRIPTION OF THIS SCRIPT
 
Posts: 842 | Thanked: 1,197 times | Joined on May 2010
#2
it:
1. Is run by /bin/sh
2. Checks if /bin/bash exists, and prints a message if it does
3. Checks if /bib/bash is a directory, prints a message if it is, and another if it isn't.
__________________
My projects: BackupMenu - OS Backup & restore | Video: Flashing your n900(LiveCD)
My devices: N770 + 8GB SD card soldered internally, N900 with 8GB SD card + Custom OC(125-950 typically).
OC freqs: 0:22,90 125:22,90 250:28,180 500:30,360 550:32,400 600:34,430 700:39,430 750:41,430 805:45,430 850:47,500 900:50,500 950:54,500 1000:58,500 1100:67,520 1150:71,520
 

The Following 2 Users Say Thank You to RobbieThe1st For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#3
use google
Bash Scripting Guide
Bash Tutorial
Bash Scripting Tutorial
and etc.
it's easy
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
pichlo's Avatar
Posts: 6,447 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#4
-f checks if the argument is a regular file
-d checks if the argument is a directory
-e checks if the argument exists

See e.g. http://ss64.com/bash/test.html
 
Reply


 
Forum Jump


All times are GMT. The time now is 09:01.