sounds like something that someone needs to write a april-1 rfc about
2013-09-03 24609, 2013
kepstin-work doesn't feel good about that, but it'll do :/
2013-09-03 24615, 2013
ocharles
how can I do $2 $3 $3 $5... ?
2013-09-03 24621, 2013
alastairp
$@
2013-09-03 24622, 2013
ocharles
basically array splices
2013-09-03 24625, 2013
ocharles
alastairp: that includes $1
2013-09-03 24626, 2013
alastairp
oh
2013-09-03 24630, 2013
alastairp
shift
2013-09-03 24632, 2013
alastairp
$@
2013-09-03 24637, 2013
ocharles
ok, i'll try that
2013-09-03 24643, 2013
alastairp
I think it's shift
2013-09-03 24653, 2013
ocharles googles
2013-09-03 24603, 2013
kepstin-work
yeah, shift will remove the first thing from an array
2013-09-03 24614, 2013
kepstin-work
there might be some fancier array slicing stuff available tho, hmm.
2013-09-03 24618, 2013
alastairp
otherwise, I think you can index arrays with {}, or [], or :
2013-09-03 24652, 2013
kepstin-work
nope, no fancy subscripts.
2013-09-03 24609, 2013
kepstin-work
... yeah, looks like using shift and $@ is your best option there
2013-09-03 24626, 2013
kepstin-work
making sure to quote $@ appropriately based on how you want it split :)
2013-09-03 24628, 2013
ocharles
so I should save $1 first?
2013-09-03 24635, 2013
kepstin-work
you'd have to, yeah.
2013-09-03 24641, 2013
ocharles
ok, cool
2013-09-03 24617, 2013
kepstin-work
it looks like there's no easy way to undo the shift and put it back
2013-09-03 24602, 2013
ocharles
i can live with that
2013-09-03 24614, 2013
ocharles
yay, all 2000 haskell modules I have installed now show up in Vim omnicompletion :)
2013-09-03 24651, 2013
alastairp
ah, "$@". I remember you well
2013-09-03 24601, 2013
kepstin-work
always fun to write shell scripts that end in 'exec /bin/foo "$@"' :)
2013-09-03 24621, 2013
ocharles
so if you do "$@", that means $1 goes to foo $1 and $2 goes to foo $2?
2013-09-03 24643, 2013
ocharles
because that's pretty much what I want to do
2013-09-03 24651, 2013
kepstin-work
"$@" is basically the same as "$1" "$2" "$3" ...
2013-09-03 24623, 2013
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
2013-09-03 24640, 2013
kepstin-work
yeah, shell quoting is *fun* :/
2013-09-03 24611, 2013
ocharles
urgh
2013-09-03 24656, 2013
kepstin-work
unless you're explicitly desiring word splitting, pretty much every variable reference should be used in quotes.
2013-09-03 24610, 2013
kepstin-work
but then, there are cases when the word-splitting is actually desired :)
2013-09-03 24634, 2013
alastairp
hmm. I've never tried to set IFS to something other that whitespace
2013-09-03 24637, 2013
alastairp
does it work?
2013-09-03 24650, 2013
kepstin-work
alastairp: yeah, but it gets really confusing really fast.
2013-09-03 24653, 2013
alastairp
:)
2013-09-03 24655, 2013
djce joined the channel
2013-09-03 24618, 2013
alastairp
hey, $* is pretty cute
2013-09-03 24635, 2013
alastairp
That is, "$*" is equivalent to "$1c$2c...", where c is the first character of the value of the IFS variable.
2013-09-03 24618, 2013
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
2013-09-03 24639, 2013
kepstin-work
sometimes you only want it set for a part of a single command, so you end up using subshells and stuff.
2013-09-03 24649, 2013
kepstin-work
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."
2013-09-03 24611, 2013
kepstin-work
which is why the word-splitting ran after the command-substitution
2013-09-03 24625, 2013
kepstin-work
although it gets really confusing when quotes are involved :/
2013-09-03 24607, 2013
jonjomckay joined the channel
2013-09-03 24607, 2013
kepstin-work
I guess the quotes are handled when parsing the command-line, prior to any of the expansions being run
2013-09-03 24625, 2013
kepstin-work
although quotes effect the behaviour of later expansions
kepstin-work is somewhat annoyed that they dropped the trackpoint buttons
2013-09-03 24624, 2013
ocharles
but more importantly i want the damn t440s to come out so i can buy it
2013-09-03 24636, 2013
ocharles
my t400 that overheats when you use two cores is not fun anymore :(
2013-09-03 24657, 2013
kepstin-work
hmm, that's... (sunglasses) not cool.
2013-09-03 24607, 2013
ocharles
i don't really care about that, i dock it and use much better input devices
2013-09-03 24620, 2013
ocharles
i guess it's a minor inconvenience when i'm at home
2013-09-03 24638, 2013
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 :)
2013-09-03 24651, 2013
kepstin-work
although I do have a decent bluetooth mouse
2013-09-03 24652, 2013
ijabz joined the channel
2013-09-03 24607, 2013
ocharles
kepstin-work: well i work from my office, but sometimes (like today) i choose to work from home
2013-09-03 24612, 2013
ocharles
so a desktop doesn't really work for me anymore
2013-09-03 24612, 2013
kepstin-work hopes they haven't dropped the bluetooth option from the new models :)
2013-09-03 24648, 2013
alastairp
kepstin-work: !!what?
2013-09-03 24617, 2013
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
2013-09-03 24652, 2013
kepstin-work is probably looking at getting an X240 with that fancy high-res screen
2013-09-03 24602, 2013
alastairp
I was just reading about the guy with the ipad and keyboard again
2013-09-03 24612, 2013
ocharles
kepstin-work: i considered that, but then that doesn't work for my commutes
2013-09-03 24622, 2013
kepstin-work still likes his R61, but it's getting a bit old now :)
2013-09-03 24639, 2013
kepstin-work
this upcoming summit will probably be the last trip I make with it :)