News for hackers. Stuff that matters.
Re:Show HN: Welder – set up your Linux server with plain she... by snissn on Friday June 09, 2017 @01:43PM (#14522969)
Could you explain what this line of code does?

    ssh -t [email protected] "$(< ./my-setup-script.sh)"
Re:Show HN: Welder – set up your Linux server with plain she... by falsedan on Friday June 09, 2017 @03:51PM (#14523954)
It's a weird way of writing

  ssh -t [email protected] /bin/bash < my-setup-script.sh
That is, take the contents of the local file 'my-setup-script.sh' and run them as commands on example.com as the 'user' user (using SSH to authenticate the user & transport the commands).
Re:Show HN: Welder – set up your Linux server with plain she... by iso-8859-1 on Saturday June 10, 2017 @07:13AM (#14526944)
But that might fail half-way through the file, and the other one is all or nothing, might just report "argument list too long".
Re:Show HN: Welder – set up your Linux server with plain she... by falsedan on Saturday June 10, 2017 @12:09PM (#14527832)
> might fail half-way through the file

Oh, while transferring!

  ssh -t [email protected] bash <( echo "function do_it() {"; cat my-setup-script.sh; echo -e "}\ndo_it" )
No argument limits to worry about, no quoting hassles.
Re:Show HN: Welder – set up your Linux server with plain she... by ianbicking on Friday June 09, 2017 @01:46PM (#14522995)
Looks like a fancier version of

        ssh -t [email protected] "$(cat ./my-setup-script.sh)"
I'll have to file this away myself!
Re:Show HN: Welder – set up your Linux server with plain she... by drdaeman on Friday June 09, 2017 @01:52PM (#14523049)
Not fancier, just a bash-ism that may not work with some other shells.

[bash] https://www.gnu.org/software/bash/manual/html_node/Command-S...

[posix] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3...

Re:Show HN: Welder – set up your Linux server with plain she... by pchm on Friday June 09, 2017 @01:55PM (#14523075)
It allows you to run a local shell script on the server via ssh, using bash command substitution - the "$(<" part. The -t option (force tty) executes the script in an interactive session - without it stuff like password prompts won't work (if I remember correctly).
Re:Show HN: Welder – set up your Linux server with plain she... by cynicalbastard on Friday June 09, 2017 @01:54PM (#14523063)
it runs the local contents of ./my-setup-script.sh on the remote server in a way that escapes all the special characters so they don't do unexpected things.