Let's develop the use of these one-liners a bit further, shall we? On Thu, Oct 21, 2010 at 1:20 PM, der.hans wrote: > Am 21. Oct, 2010 schwätzte Hunter Kreie so: > > > Although the for loop will probably work for your PHP files, I generally >> prefer using a different method for processing lists of files. >> >> /bin/ls *.php | while read i ; do echo "text" >> $i ; done >> >> This will handle files with spaces in them and gives you more flexibility >> with the input list. For instance, if you have a bunch of subdirectories, >> you could use find instead. >> > > You're correct, my loop has problems with files that have spaces in the > name. > > Your loop is better for a standalone task like this. Anything required to use regularly, might be setup as alias added to your own personal .bashrc file: alias textphp="/bin/ls *.php | while read i ; do echo "text" >> $i ; done" When one has to use repeated commands like anything for which one might repeatedly need to use while loops, a .bashrc assists to provide a means of ownership of complex technology. In some shops it's even allowed to maintain a NFS, CIFS shared /bin with scripts and tools submitted and available for use by all engineers, administrators? > > > ciao, > > der.hans > -- > # http://www.LuftHans.com/ http://www.LuftHans.com/Classes/ > # "The purpose of IT is to seamlessly and transparently provide the other > # 9/10's of the iceberg for people who need to work with chunks > # of floating ice." -- Strata Rose Chalup > --------------------------------------------------- > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > To subscribe, unsubscribe, or to change your mail settings: > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss > -- Skype: 6022393392 ATT: 5037544452 GV: 6236883392 http://www.it-clowns.com Politicians should read science fiction, not westerns and detective stories. -Arthur C. Clark I am free because I know that I alone am morally responsible for everything I do. -Heinlein