Advertise on warmetal.nl!
Click for more information
about advertising here.

Did you find this website useful? Did I save you a lot of time?
Please consider donating to support this site:

 

Script: Bash: If file in directory then

This is a short special page just dedicated to one command or script. The purpose here is just for me to learn scripting. I think most people will think these snippets are too simple too take notice from.
for i in `ls -1 | grep was-`; do if [ -f $i/.run ]; then echo start slot $i; fi; done
  • ls -1 lists all files and directories each on a separate line
  • [ -f ] is true if listed file is a regular file

Discussion

Enter your comment:
 
scriptbashaix1.txt · Last modified: 2010/10/08 13:25 by sjoerd