PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > view the exit status from command line
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

view the exit status from command line

Réponse
 
LinkBack Outils de la discussion
Vieux 15/08/2007, 09h30   #1
Kamaraju Kusumanchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut view the exit status from command line

Let's say I run a command in bash which is run via konsole. How can I view its exit status.

For example, if I do

$test -x debian/rules

I want to know if the command exited with status zero or non-zero. Can this be done in a simple way?

thank for any suggestions
raju

----------------------------------------------------------------------
Finally - A spam blocker that actually works.
http://www.bluebottle.com/tag/4


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 09h40   #2
Glennie Vignarajah
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Le Wednesday 15 August 2007, Kamaraju Kusumanchi(Kamaraju Kusumanchi
<kamaraju@bluebottle.com>) a écrit:

Hi,

> Let's say I run a command in bash which is run via konsole. How
> can I view its exit status.
>
> For example, if I do
>
> $test -x debian/rules


try:
test -x debian/rules ; echo $?
HTH,

--
Glennie Vignarajah
http://www.glennie.fr
An undefined problem has an infinite number of solutions.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 09h40   #3
Glennie Vignarajah
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Le Wednesday 15 August 2007, Kamaraju Kusumanchi(Kamaraju Kusumanchi
<kamaraju@bluebottle.com>) a écrit:

Hi,

> Let's say I run a command in bash which is run via konsole. How
> can I view its exit status.
>
> For example, if I do
>
> $test -x debian/rules


try:
test -x debian/rules ; echo $?
HTH,

--
Glennie Vignarajah
http://www.glennie.fr
An undefined problem has an infinite number of solutions.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 12h20   #4
Joachim Fahnenmüller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Hi Kamaraju

On Wed, Aug 15, 2007 at 12:51:06AM -0700, Kamaraju Kusumanchi wrote:
> Let's say I run a command in bash which is run via konsole. How can I view its exit status.
>
> For example, if I do
>
> $test -x debian/rules
>
> I want to know if the command exited with status zero or non-zero. Can this be done in a simple way?


$test -x debian/rules; echo $?

man bash:
Special Parameters
(...)
? Expands to the status of the most recently executed foreground
pipeline.

>
> thank for any suggestions
> raju
>


HTH
--
Joachim Fahnenmüller


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 12h20   #5
Joachim Fahnenmüller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Hi Kamaraju

On Wed, Aug 15, 2007 at 12:51:06AM -0700, Kamaraju Kusumanchi wrote:
> Let's say I run a command in bash which is run via konsole. How can I view its exit status.
>
> For example, if I do
>
> $test -x debian/rules
>
> I want to know if the command exited with status zero or non-zero. Can this be done in a simple way?


$test -x debian/rules; echo $?

man bash:
Special Parameters
(...)
? Expands to the status of the most recently executed foreground
pipeline.

>
> thank for any suggestions
> raju
>


HTH
--
Joachim Fahnenmüller


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 14h40   #6
Kamaraju S Kusumanchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Joachim Fahnenmüller wrote:

>> For example, if I do
>>
>> $test -x debian/rules
>>
>> I want to know if the command exited with status zero or non-zero. Can
>> this be done in a simple way?

>
> $test -x debian/rules; echo $?
>


Thanks. Exactly what I am after!

raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 14h40   #7
Kamaraju S Kusumanchi
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Joachim Fahnenmüller wrote:

>> For example, if I do
>>
>> $test -x debian/rules
>>
>> I want to know if the command exited with status zero or non-zero. Can
>> this be done in a simple way?

>
> $test -x debian/rules; echo $?
>


Thanks. Exactly what I am after!

raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 15/08/2007, 15h40   #8
Sven Joachim
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: view the exit status from command line

Kamaraju S Kusumanchi <kamaraju@bluebottle.com> writes:

>>> I want to know if the command exited with status zero or non-zero. Can
>>> this be done in a simple way?

>>
>> $test -x debian/rules; echo $?
>>

>
> Thanks. Exactly what I am after!


Here's a $0.02 recipe from my ~/.bashrc:

if [ "$PS1" ]; then
PROMPT_COMMAND='echo -n "$? "'
fi

This way, an interactive bash will print the exit status of the last
command before its prompt, so you can _always_ see it. Very handy,
IMO. :-)

Cheers,
Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h59.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12230 seconds with 16 queries