4 ms·
wow, this was very enlightening! I was wondering if you could elaborate a little bit on what you mean by: > as you're locally specifying the args without any
by wadkar 7y ago
wow, this was very enlightening!
I was wondering if you could elaborate a little bit on what you mean by:
> as you're locally specifying the args without any further IFS interference
I know that IFS = Input Field Separator. But how does it interfere when doing su root -c “command”? I might be missing something obvious here.
Also the ssh + printf is gold! But to be honest, I would personally never use anything from $@ inside an ssh remote “command”. Too risky even with proper quoting.
Thanks!
- floatingatoll 7y agoIFS controls the "$* joining character, if I remember correctly, and so if you use IFS=\0 then you can “safely” pass multiparty args in and then somehow take them apart on the other side. But this is the bad kind of crazy to me, and if I was reviewing code with this in it, I’d flag it for replacement. It’s the sort of thing that leads to feeling smart at working around knowing $@ but in the end it’s best just to truly understand $@ or use helper scripts to avoid quoting drama altogether. YMMV.