On Friday, March 19, 2004, at 08:35 AM, Justin Walker wrote:
On Friday, March 19, 2004, at 12:49 AM, kp.gores wrote:
hi,
i am writing some scripts (using shell, sed, awk) and need to test properties of files.
thus i found out about "test"
unfortunately test returns *nothing*, e.g.
test "abc" = "def" test 3 -gt 4
returning nothing, which according to `man test` means true.
I am afraid I overlooked something....any help appreciated
Did you look at the 'man' page for "test"?
Let me be a bit more clear: the command 'test' returns a numerical "return code" (either 0 or 1). You don't see this when you invoke the command by hand in an interactive shell.
To see the return code of a command-line command, use [in bash/sh/zsh] "echo $?".
You can "test" the return code with commands like the following:
if test -f /path/to/file then cat /path/to/file else echo "whoops!" fi
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | Some people have a mental
| horizon of radius zero, and
| call it their point of view.
| -- David Hilbert
*--------------------------------------*-------------------------------*------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Fink-beginners mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-beginners
