Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

touch command...



> 	You can 'touch' a file that doesn't exist yet, and that way it
> gets created (an empty file).

In this situation, it's marginally more efficient (in a shell scripting
environment) to let the shell create the file using i/o redirection:

  touch file

and

  >> file

Will both create "file" if it didn't already exist.  If the file
already existed, "touch file" will update the modification time, while
">> file" will not ("> file" is similar, but it will *truncate* the
file if it exists.  This is sometimes what you want.).

Using ">> file" is "marginally more efficient" because it doesn't
involve the fork and exec necessary to run touch.  If you've got a
shell loop that has to do this many times you'll probably notice a
difference, but otherwise you won't.

-- Lars



=====
lars at larsshack.org --> http://www.larsshack.org/
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org