VaultNetwork.net Vault Network Boards
Author Topic: OT: Any PERL wizards out there? [Locked]
Daminada
Posts: 39
Registered: 2002-4-3 08:05:50
I'm having to maintain some code and ran across the following line:

echo $CMD | at now +1 minute > /tmp/send.cron 2>&1

From what I can tell it's taking the command defined in $CMD and sending it to a cron job.. my guess is that it's adding 1 minute to now for the command to fire off. But what does the 2>$1 mean? If I'm way off here, jump in!

 

-----signature-----
Keep in mind almost everything I said here on these forums has come true exactly as I said and I was laughed at and insulted,
as usual. --Xalaten
DarkPCK  2 stars
Title: Got to go house is on fire.
Posts: 457
Registered: 2003-12-14 12:38:01
It redirects stderr (2) to stdout (1). The ampersand (& is used as a prefix to indicate that the "1" is a file descriptor rather than a file name.

 

-----signature-----
http://tinyurl.com/l6vz3g
DakRT: And 4 Scouts makes a [stealth] zerg huh?
Zyzyg: What anytime snare are you talking about?...Your anytime style should be Polar Rift. Clearly you don't play a Shadowblade.
Steot: Its fact, I just dont have proof.
Zyzyg  1 star
Title: Geniuss Extraordinaire
Posts: 109
Registered: 2002-12-30 23:35:23
DarkPCK posted:

It redirects stderr (2) to stdout (1). The ampersand (& is used as a prefix to indicate that the "1" is a file descriptor rather than a file name.


I have no idea what the hell Dark just said, but I'm going to agree with him since he agreed with me in another thread. Might as well start the new year out right.

 

-----signature-----
It takes a lot of nails to build a crib, but just one screw to fill it.
Everywhere is walking distance if you have enough time.
http://gimpchimp.etilader.com/s.php?u=zyzyg
Daminada
Posts: 39
Registered: 2002-4-3 08:05:50
Interesting, are the assumptions I made about the rest correct?

 

-----signature-----
Keep in mind almost everything I said here on these forums has come true exactly as I said and I was laughed at and insulted,
as usual. --Xalaten
DarkPCK  2 stars
Title: Got to go house is on fire.
Posts: 457
Registered: 2003-12-14 12:38:01
For the most part.

$CMD goes to stdout (one minute from when the command gets submitted)
stderr goes to stdout
stdout goes to /tmp/send.cron

If you're new to UNIX shell, look up i/o redirection.

 

-----signature-----
http://tinyurl.com/l6vz3g
DakRT: And 4 Scouts makes a [stealth] zerg huh?
Zyzyg: What anytime snare are you talking about?...Your anytime style should be Polar Rift. Clearly you don't play a Shadowblade.
Steot: Its fact, I just dont have proof.

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.