User: Password:
|
|
Subscribe / Log in / New account

Fish - The friendly interactive shell

Fish - The friendly interactive shell

Posted May 30, 2005 17:10 UTC (Mon) by Jyhem (guest, #29388)
In reply to: Fish - The friendly interactive shell by liljencrantz
Parent article: Fish - The friendly interactive shell

Are you saying that if you write

for i in *.bak; rm $i; end

then if there is no backup file present, I will have all the files in the directory deleted ?

I hope you intend to implement "undo" :-D


(Log in to post comments)

Fish - The friendly interactive shell

Posted May 30, 2005 21:15 UTC (Mon) by liljencrantz (guest, #28458) [Link]

Look at your example again... If *.bak does not match anything, the for loop body will execute exactly zero times. So the rm command will _never_ be run. And even if it had, running rm without any parameters doas not remove anything. So you are doubly safe.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds