Compare cert salaries and plan your next career move
Gomjaba wrote: » Actually you could just add those lines into a file called something.sh then make it executable chmod +x something.sh and execute it ./something.sh Dirty - but works
TODAY_DATE=`date +%d%m%Y` mkdir /backup/$TODAY_DATE
mkdir: cannot create directory `25032011': File exists
if [ -d /tmp ]; then echo "/tmp exists" fi if [ -x /bin/true ]; then echo "/bin/true is executable" fi
if [ ! -z /etc/motd ]; then echo "/etc/motd is NOT empty" fi
lordy wrote: » You should have a look at "man test". There are a bunch of these tests that you can run. Example:if [ -d /tmp ]; then echo "/tmp exists" fi if [ -x /bin/true ]; then echo "/bin/true is executable" fi You can invert these checks by using !.if [ ! -z /etc/motd ]; then echo "/etc/motd is NOT empty" fi PS: The message filter on this board sukcs. You cannot write "/etc/p a s s w d" in your post. Took 5 minutes of my precious time to figure that out...
if [ -d /some/directory ]; then cp /some/directory/* /some/other/directory/ fi
lordy wrote: » It's easy. You can put anything between if and fi that you need. Example:if [ -d /some/directory ]; then cp /some/directory/* /some/other/directory/ fi
FILE exists and is a directory
Compare salaries for top cybersecurity certifications. Free download for TechExams community.