5 ms·
TL;DR: a 3 line exercise in bash argument munging. t="${!#}" c=("ssh" "-t" "${@:1:$(($#-1))}" "${t%:*}" "cd ${t##*:}; \$SHELL -l") "${c[@]}" That's lite
by aegiso 13y ago
TL;DR: a 3 line exercise in bash argument munging.
t="${!#}"
c=("ssh" "-t" "${@:1:$(($#-1))}" "${t%:*}" "cd ${t##*:}; \$SHELL -l")
"${c[@]}"
That's literally the whole repo.
- ChristianBundy 13y agoLiterally. We both know that it would've been easier to write this in Python, Ruby, Javascript, etc., but at the cost of using an "uncool" language I was able to solve the problem in three lines with only bash as a dependency. Pull requests welcome.
- blueskin_ 13y agoI am thankful you didn't. Congratulations on getting the *NIX philosophy right.
- lmm 13y agoIf that's the ★nix philosophy I don't want to be a ★nix person any more. Seriously, even my VMS machines have python installed, and a script I can read is a lot better than one I can't, even if the one I can read has an extra dependency.
- blueskin_ 13y agoPython isn't too bad (unless you're calling the script in a lot of separate instances), but python is fairly neat compared to ruby/javascript/whatever trendy language of the week as it doesn't need a huge pile of worthless dependencies itself.
- aet 13y agohttp://en.wikipedia.org/wiki/Unix_philosophy http://en.wikipedia.org/wiki/Unix_philosophy "The Unix philosophy emphasizes building short, simple, clear, modular, and extendable code that can be easily maintained and repurposed by developers other than its creators. The philosophy is based on composable (rather than contextual) design."
- dpacmittal 13y agoCan you explain this code?
- ChristianBundy 13y agoDefinitely. Here's a gist, feel free to comment with any questions! https://gist.github.com/christianbundy/8954786 https://gist.github.com/christianbundy/8954786
- gcommer 13y agoWhy not distribute that as the code in the repo instead of the compressed version?