in reply to check if chdir() has work
It's a moderately important trope as well. At a former employer, they had shell code that went something like:chdir $my_dir or die("Cannot cd into directory $my_dir.\n");
See, when chdir fails, and you're root, you end up in the root directory. And the server on which this script was run, well the Important Directory was moved for some reason. And so the script cd's to "/" and the next command started running..#!/bin/ksh Important_Directory=/foo/bar cd Important_Directory rm -rf * # # more stuff here #
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: check if chdir() has work
by runrig (Abbot) on Mar 14, 2008 at 17:17 UTC |