* bash script problem
@ 2002-12-10 2:08 Daniel Peter Cavanagh
2002-12-10 16:55 ` ichi
2002-12-10 17:07 ` Brian Jackson
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Peter Cavanagh @ 2002-12-10 2:08 UTC (permalink / raw)
To: linux-newbie
Hi,
I'd like to write a script that will run a command, and if successful
run another command otherwise echo a message.
This is what I have but it doesn't work (I've never written a bash
script before):
if [ `fetchmail -su nofsk pop.vtown.com.au` ]; then
pine
else
echo failed fetch
fi
Could something please fix this up. Thanks for your help, Daniel.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: bash script problem
2002-12-10 2:08 bash script problem Daniel Peter Cavanagh
@ 2002-12-10 16:55 ` ichi
2002-12-10 21:19 ` Chuck Gelm
2002-12-10 17:07 ` Brian Jackson
1 sibling, 1 reply; 4+ messages in thread
From: ichi @ 2002-12-10 16:55 UTC (permalink / raw)
To: Daniel Peter Cavanagh; +Cc: linux-newbie
Daniel Peter Cavanagh wrote:
>
> I'd like to write a script that will run a command,
> and if successful run another command otherwise echo
> a message.
How about this:
------------------------------------
fetchmail -su nofsk pop.vtown.com.au
case $? in 0) pine;;
*) echo failed fetch;;
esac
------------------------------------
Cheers,
Steven
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: bash script problem
2002-12-10 16:55 ` ichi
@ 2002-12-10 21:19 ` Chuck Gelm
0 siblings, 0 replies; 4+ messages in thread
From: Chuck Gelm @ 2002-12-10 21:19 UTC (permalink / raw)
To: linux-newbie
Check this bash script for me, please.
#/bin/sh
#
# if a floppy can be formatted 1.68 megabytes
# with 0 bad blocks
# else
# format 1.44 megabytes
# fi
# mkfs.msdos /dev/fd0
#
if (superformat /dev/fd0u1680 && badblocks -c 512 -n /dev/fd0u1680);
then
mkfs.msdos /dev/fd0u1680
else superformat /dev/fd0u1440
mkfs.msdos /dev/fd0u1440
fi
mdir
#
I'm thinking that 'badblocks' can find bad blocks and still return
a 'true' condition. If this is true, is there any way to cause
the smaller format?
If 'superformat /dev/fd0u1680' fails, it drops back to '/dev/fd0u1440'.
Regards, Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bash script problem
2002-12-10 2:08 bash script problem Daniel Peter Cavanagh
2002-12-10 16:55 ` ichi
@ 2002-12-10 17:07 ` Brian Jackson
1 sibling, 0 replies; 4+ messages in thread
From: Brian Jackson @ 2002-12-10 17:07 UTC (permalink / raw)
To: Daniel Peter Cavanagh; +Cc: linux-newbie
Try this:
fetchmail -su nofsk pop.vtown.com.au && pine || echo failed fetch
see if that works for you.
--Brian Jackson
Daniel Peter Cavanagh writes:
> Hi,
>
> I'd like to write a script that will run a command, and if successful run
> another command otherwise echo a message.
>
> This is what I have but it doesn't work (I've never written a bash script
> before):
>
> if [ `fetchmail -su nofsk pop.vtown.com.au` ]; then
> pine
> else
> echo failed fetch
> fi
>
> Could something please fix this up. Thanks for your help, Daniel.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-12-10 21:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-10 2:08 bash script problem Daniel Peter Cavanagh
2002-12-10 16:55 ` ichi
2002-12-10 21:19 ` Chuck Gelm
2002-12-10 17:07 ` Brian Jackson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.