You are not logged in.

#1 2010-12-30 11:43:26

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

[solved] use command's return

hi to all

how can i use the return of a command executed in a terminal ?

thanks

Last edited by nTia89 (2010-12-30 14:32:34)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2010-12-30 12:26:43

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: [solved] use command's return

What do you mean by return? The exit status or the output of a command?


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#3 2010-12-30 12:34:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] use command's return

Or do you mean the output?

Offline

#4 2010-12-30 12:45:32

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [solved] use command's return

If you mean exit code:

echo $?

Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2010-12-30 13:49:41

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] use command's return

sisco311 wrote:

What do you mean by return? The exit status or the output of a command?

this! the exit status: 1,0,-1.....


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#6 2010-12-30 14:03:56

sisco311
Member
From: Romania
Registered: 2008-05-23
Posts: 112

Re: [solved] use command's return


don't drink unwashed fruit juice.
i never make predictions, especially about the future.

Offline

#7 2010-12-30 14:04:25

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,487
Website

Re: [solved] use command's return

In what language?

Offline

#8 2010-12-30 14:12:36

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] use command's return

Allan wrote:

In what language?

bash

thanks very much is what i was searching !

Last edited by nTia89 (2010-12-30 14:17:22)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#9 2010-12-30 14:17:30

Whip
Member
Registered: 2010-10-08
Posts: 10

Re: [solved] use command's return

As posted above by .:B:., the exit code of the last run program is stored in the $? variable.

Offline

Board footer

Powered by FluxBB