POSIX shell trivia
- Nov. 28th, 2007 at 10:06 PM
#!/bin/sh false if [ $? = 1 ] then echo $? fi
The above code block outputs "0". If $? is defined as, "Expands to the status of the most recently executed foreground pipeline," can you define exactly why the output is "0"?
hint: expr test (updated)
Tags:

Profile
jasondclinton
- Jason D. Clinton
Latest Month
| September 2011 | ||||||
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | |
Tags
- 3d
- 3d uis
- accomplishment
- achievements
- acpi
- act
- activism
- activity journal
- adp1
- advanced clustering
- advertising
- algorithms
- amazon
- amd
- analogy
- android
- animation
- anxiety
- art
- atheism
- audio
- auditing
- autotools
- awesomeness
- backup
- band
- beowulf
- birthday
- blastfromthepast
- blogs
- book
- bostom
- boston
- breakin
- bugs
- bugzilla
- c#
- c++
- cairo
- canada
- canvas
- canvases
- career
- celluar
- cellular
- chicago
- clustering
- clutter
- cmake
- code
- coding
- communities
- community
- compiler
- composite
- computer science
- conceit
- conferences
- consolekit
- cool
- coupons
- css
- customer service
- dbus
- dconf
- death
- debian
- debian live
- democracy
- dependencies
- design
- desktop
- developers
- development
- devicekit
- doa
- donations
- dri2
- drm
- dynamic linking
- effeciency
- effects
- email clients
- emerillon
- employment
- evolution
- excercize
- existentialism
- experience
- ext3
- ext4
- eye candy
- fail
- family
- filesystems
- film
- firefox
- firefox 3
- flamewar
- focus
- fonts
- foss
- free software
- freenode
- friends
- friends of gnome
- fsync
- fund-raising
- funny
- g1
- gadgets
- games
- gay
- gay marriage
- gconf
- gecko
- geekiness
- geeky
- gender
- geolocation
- gio
- git
- glbt
- gmail
- gnome
- gnome 3
- gnome 3.0
- gnome games
- gnome shell
- gnome-games
- gnometris
- goals
- gobject
- gpu
- graphics
- greetings
- gtk
- gtk#
- gtk+
- gtkmm
- guadec
- hackfest
- hacking
- hal
- happiness
- hardware
- hig
- hiring
- hoe
- holiday
- house
- hpc
- hpl
- html
- humanism
- humanity
- humor
- i18n
- ie
- imap
- indexing
- insanity
- intel
- international
- internet explorer
- introspection
- jobs
- joke
- just works
- kansas
- kansas city
- kde
- kernel
- lament
- laptop
- lazyweb
- lgbt
- libchamplain
- life
- linux
- linux desktop
- liveblog
- lsb
- ludites
- m4a
- malaise
- marketing
- mesa
- meta
- metacity
- mock-up
- mono
- motivation
- mozilla
- mp3
- mp3 downloads
- mp4
- music
- myspace
- novell
- nvidia
- obama
- open source
- opengl
- opensource
- optimization
- oss
- outreach
- packaging
- palm
- pango
- party
- passages
- patch
- patch review
- people
- performance
- permissions
- personal
- philosophy
- phone
- pictures
- planning
- podcast
- policykit
- politicis
- politics
- polkit
- power
- practice
- praise
- programming
- ps3
- publishing
- pulseaudio
- queer
- rant
- release
- religion
- remote access
- rendering
- review
- rewrite
- ruby
- ruby programming language
- rubygems
- sad
- safedesk
- sam brownback
- sartre
- school
- scm
- screen cast
- screen shot
- screencast
- screencasting
- search
- security
- selinux
- shell
- silly
- skepticism
- sound
- sprint
- sqlite
- standards
- story
- stress
- success
- summit
- t-mobile
- teams
- technology
- testing
- themes
- thunderbird
- tomboy
- toys
- transparency
- travel
- u.s. senate
- ubuntu
- ui
- umkc
- unboxing
- unity
- usability
- user interfaces
- vacation
- verizon
- video
- videos
- violence
- voting
- war
- web
- web 2.0
- web browsers
- webkit
- wireless
- women
- work
- workflow
- xgl
- ximian
- xrender
- yahoo
- zen
- zimbra
Page Summary
ivazquez : (no subject) [+3]
beranger_org : (no subject) [+1]
fragglet : Shell scripts [+0]
- (Anonymous) : (no subject) [+0]
Powered by LiveJournal.com
Designed by Tiffany Chow
Comments
GCC should have a -Werrno switch that complains if errno is used for anything but assigning it to something else.
+ false
+ '[' 1 = 1 ']'
+ echo 0
0