Timeline for Getting the last argument passed to a shell script
Current License: CC BY-SA 2.5
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 17, 2023 at 21:20 | comment | added | pylover |
Also works on the ash .
|
|
Jun 6, 2020 at 7:11 | comment | added | oguz ismail |
@mcoolive On Solaris sh for last do true; done (no semicolon after last ) works. That actually works with all sh implementations I have on my computer.
|
|
Nov 22, 2019 at 10:41 | comment | added | Dominik R | @mcoolive: it even works in the unix v7 bourne shell from 1979. you can't get more portable if it runs on both v7 sh and POSIX sh :) | |
Apr 23, 2018 at 18:59 | comment | added | Adrian Günter |
@mcoolive @LaurenceGolsalves beside being more portable, for last in "$@"; do :; done also makes the intent much clearer.
|
|
Jan 25, 2016 at 10:47 | comment | added | mcoolive | With an old Solaris, with the old bourne shell (not POSIX), I have to write "for last in "$@"; do true; done" | |
Oct 9, 2015 at 5:35 | comment | added | Rufflewind |
@MichałŠrajer true is part of POSIX.
|
|
Feb 26, 2013 at 8:24 | comment | added | Paweł Nadolski | @MichałŠrajer, I think you meant colon and not comma ;) | |
Sep 9, 2012 at 7:05 | review | Suggested edits | |||
Sep 9, 2012 at 7:13 | |||||
Dec 6, 2009 at 0:33 | vote | accept | Thomas | ||
Dec 6, 2009 at 0:16 | history | answered | Laurence Gonsalves | CC BY-SA 2.5 |