In <20090628141815.gm2...@pear.tzafrir.org.il>, Tzafrir Cohen wrote:
>On Sun, Jun 28, 2009 at 11:42:58AM +0200, Michelle Konzack wrote:
>> But I would prefer something like:
>>
>> if [ $(cd "$1") -ne 0 ]
>> then echo "badbadbad" ; exit 1
>> fi
>
>Note that this runs the 'cd' command
In <20090628094255.ga12...@freenet.de>, Michelle Konzack wrote:
>Am 2009-06-28 11:39:55, schrieb Soren Orel:
>> I can /dev/null the error messages like:
>>
>> cd "$1" 2> /dev/null
>>
>> e.g.: I get error If "$1" has spaces in it
>>
>> Ok, but how can I grep the error message? I tried:
>>
>> if cd "
final solution:
if ! cd "$1"; then echo "error"; exit 1; fi
thank you!
Hi,
On Sun, Jun 28, 2009 at 11:39:55AM +0200, Soren Orel wrote:
> I can /dev/null the error messages like:
>
> cd "$1" 2> /dev/null
2> will redirect to a file /dev/null
> e.g.: I get error If "$1" has spaces in it
>
> Ok, but how can I grep the error message? I tried:
>
> if cd "$1" 2> grep
On Sun, Jun 28, 2009 at 11:42:58AM +0200, Michelle Konzack wrote:
> But I would prefer something like:
>
> if [ $(cd "$1") -ne 0 ]
> then echo "badbadbad" ; exit 1
> fi
Note that this runs the 'cd' command in a subdirectory, and thus it has
no effect on the parent process.
And t
$ sh script.sh /home/user/Desktop/some existing dir with spaces
script.sh: line 2: cd: /home/gbor/Desktop/some: No such file or directory
script.sh: line 2: [: -ne: unary operator expected
$ cat script.sh
#!/bin/bash
if [ $(cd "$1") -ne 0 ]
then echo "badbadbad" ; exit 1
fi
I just want to make m
Am 2009-06-28 11:48:54, schrieb me:
> hehe, answered at the same time :D
=8http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack c/o Shared Office KabelBW ICQ #328449886
+49/177/9351947Blumenstasse 2 MSN LinuxMichi
+33/6/
hehe, answered at the same time :D
2009/6/28 me
> Hi,
>
> how about:
>
>
> cd "$1"
>
> if [ $? != '0' ]; then
> echo "damn."
> exit;
> fi
>
>
> greetings,
> vitaminx
>
>
> 2009/6/28 Soren Orel
>
> I can /dev/null the error messages like:
>>
>> cd "$1" 2> /dev/null
>>
>> e.g.: I get error If
Hi,
how about:
cd "$1"
if [ $? != '0' ]; then
echo "damn."
exit;
fi
greetings,
vitaminx
2009/6/28 Soren Orel
> I can /dev/null the error messages like:
>
> cd "$1" 2> /dev/null
>
> e.g.: I get error If "$1" has spaces in it
>
> Ok, but how can I grep the error message? I tried:
>
> if
Am 2009-06-28 11:39:55, schrieb Soren Orel:
> I can /dev/null the error messages like:
>
> cd "$1" 2> /dev/null
>
> e.g.: I get error If "$1" has spaces in it
>
> Ok, but how can I grep the error message? I tried:
>
> if cd "$1" 2> grep -i "No such file or directory"; then echo "badbadbad";
> e
I can /dev/null the error messages like:
cd "$1" 2> /dev/null
e.g.: I get error If "$1" has spaces in it
Ok, but how can I grep the error message? I tried:
if cd "$1" 2> grep -i "No such file or directory"; then echo "badbadbad";
exit; fi
But it doesn't work :S
thank you!
11 matches
Mail list logo