On Thu, Oct 04, 2007 at 01:21:32PM +1000, Ronny Haryanto wrote:
> > > > gimana untuk menangkap error nya ya dgn grep ? jadi untuk perintah
> > > > mysql..(1), jika ada error tidak akan diteruskan ke perintah
> > >
> > > ngga ngecek error codenya aja? ada di variabel "$?" (dolar tandatanya)
> >
> > bisa dikasih contohnya pak, atau manpage nya jg gpp.
> 
> Seperti dibilang Mas Arief, referensinya di man page dari shell yg dipake.
> Kalo scriptnya pake bash ya man bash.
> 
> Assuming pake flavour bourne shell (termasuk bash).
> $? itu berisi nilai return/exit code dari command yg dijalankan sebelumnya.
> Command/program apa pun seharusnya mengembalikan exit code setelah selesai.
> (Ini lah kenapa kalo bikin program C, main() nya harus return integer).
> 
> Nilai 0 artinya success. Selain itu tergantung programnya, terserah
> programnya itu code artinya apa. Biasanya non-zero artinya tidak
> sukses mulus.
> 
> `somecommand`
> exitcode="$?"
> if [ "$exitcode" -eq 0 ]; then
>     echo Sukses
> else
>    echo "Gagal, dengan kode $exitcode"
> fi
> 
> Ronny
> 
> -- 
ok, tks bgt mas2, udah berhasil.:)


This e-mail message may contain legally privileged and/or confidential 
information. If you are not the intended recipient(s), or the employee or agent 
responsible for delivery of this message to the intended recipient(s), you are 
hereby notified that any dissemination, distribution or copying of this e-mail 
message is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete this e-mail message from your 
computer.

-- 
FAQ milis di http://wiki.linux.or.id/FAQ_milis_tanya-jawab
Unsubscribe: kirim email ke [EMAIL PROTECTED]
Arsip dan info milis selengkapnya di http://linux.or.id/milis

Kirim email ke