sounds like something that someone needs to write a april-1 rfc about
kepstin-work doesn't feel good about that, but it'll do :/
ocharles
how can I do $2 $3 $3 $5... ?
alastairp
$@
ocharles
basically array splices
alastairp: that includes $1
alastairp
oh
shift
$@
ocharles
ok, i'll try that
alastairp
I think it's shift
ocharles googles
kepstin-work
yeah, shift will remove the first thing from an array
there might be some fancier array slicing stuff available tho, hmm.
alastairp
otherwise, I think you can index arrays with {}, or [], or :
kepstin-work
nope, no fancy subscripts.
... yeah, looks like using shift and $@ is your best option there
making sure to quote $@ appropriately based on how you want it split :)
ocharles
so I should save $1 first?
kepstin-work
you'd have to, yeah.
ocharles
ok, cool
kepstin-work
it looks like there's no easy way to undo the shift and put it back
ocharles
i can live with that
yay, all 2000 haskell modules I have installed now show up in Vim omnicompletion :)
alastairp
ah, "$@". I remember you well
kepstin-work
always fun to write shell scripts that end in 'exec /bin/foo "$@"' :)
ocharles
so if you do "$@", that means $1 goes to foo $1 and $2 goes to foo $2?
because that's pretty much what I want to do
kepstin-work
"$@" is basically the same as "$1" "$2" "$3" ...
alastairp
whereas $@ is unescaped, so if it's 3 things long, and $2 has a space in it, the program it's passed to will get 4 args
kepstin-work
yeah, shell quoting is *fun* :/
ocharles
urgh
kepstin-work
unless you're explicitly desiring word splitting, pretty much every variable reference should be used in quotes.
but then, there are cases when the word-splitting is actually desired :)
alastairp
hmm. I've never tried to set IFS to something other that whitespace
does it work?
kepstin-work
alastairp: yeah, but it gets really confusing really fast.
alastairp
:)
djce joined the channel
hey, $* is pretty cute
That is, "$*" is equivalent to "$1c$2c...", where c is the first character of the value of the IFS variable.
kepstin-work
the tricky bit with playing with IFS is making sure it's only set where you want it, and then unset/reset right afterwards
sometimes you only want it set for a part of a single command, so you end up using subshells and stuff.
but yeah, "The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion."
which is why the word-splitting ran after the command-substitution
although it gets really confusing when quotes are involved :/
jonjomckay joined the channel
I guess the quotes are handled when parsing the command-line, prior to any of the expansions being run
although quotes effect the behaviour of later expansions
kepstin-work is somewhat annoyed that they dropped the trackpoint buttons
but more importantly i want the damn t440s to come out so i can buy it
my t400 that overheats when you use two cores is not fun anymore :(
kepstin-work
hmm, that's... (sunglasses) not cool.
ocharles
i don't really care about that, i dock it and use much better input devices
i guess it's a minor inconvenience when i'm at home
kepstin-work
I use my laptop mostly on the go; if I'm somewhere where I could use good input devices, I have a proper desktop :)
although I do have a decent bluetooth mouse
ijabz joined the channel
ocharles
kepstin-work: well i work from my office, but sometimes (like today) i choose to work from home
so a desktop doesn't really work for me anymore
kepstin-work hopes they haven't dropped the bluetooth option from the new models :)
alastairp
kepstin-work: !!what?
kepstin-work
yeah, so much of my stuff is virtual servers or cloud stuff that it doesn't really matter where I'm working from as long as I have my git checkouts and ssh keys
kepstin-work is probably looking at getting an X240 with that fancy high-res screen
alastairp
I was just reading about the guy with the ipad and keyboard again
ocharles
kepstin-work: i considered that, but then that doesn't work for my commutes
kepstin-work still likes his R61, but it's getting a bit old now :)
kepstin-work
this upcoming summit will probably be the last trip I make with it :)