Here's a weird one for you: (cat 1liner.sh | sh)

I am very confused and curious.

I am following the Linode guide to install FreeBSD and I got as far as booting into Finnix, dd'ing the latest memdisk.img to /dev/sda.

For some reason, pasting

curl ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.2/FreeBSD-10.2-RELEASE-amd64-memstick.img | dd of=/dev/sda

into Weblish did not work (curl 0 bytes read forever).
I tried Glish, but there is no paste there (that I could find), so I tried typing manually, only it seems Glish is set to a us keymap and I couldn't find a way to input the pipe character from my keyboard. Anyway, this is not my query.

The next thing I tried was to go back to Weblish:

root@ttyS0:~# echo "curl ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.2/FreeBSD-10.2-RELEASE-amd64-memstick.img | dd of=/dev/sda" > grab.sh
root@ttyS0:~# chmod +x grab.sh
root@ttyS0:~# ./grab.sh

This did not work either.

For whatever reason I thought I'd try

root@ttyS0:~# cat grab.sh | sh

and that worked.

WHY?

1 Reply

From your description of the issue, it sounds like you just need to add the Shebang to your .sh script in order for that to work from the command line. You can find a ton of informmation on the shebang, and why it's necessary on the following Wikipedia article:
https://en.wikipedia.org/wiki/Shebang_(Unix)

In addition, you may want to look over the FreeBSD download page to check for the latest version.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct