#!/bin/bash on FreeBSD
A great number of people write bash scripts for Linux.
Most of these scripts start with #!/bin/bash
.
bash is not installed on FreeBSD by default.
When installed, it is installed in /usr/local/bin/bash.
This post covers a few strategies for using scripts that start with #!/bin/bash
on FreeBSD.
I used one of these strategies in a previous post.
Software Versions
Instructions
First, bash needs to be installed.
The simplest option is to create a symlink from /usr/local/bin/bash to /bin/bash.
At this point, the following script should work without modification.
hello_world.sh
If you object to adding a symlink, the following command can be used to
replace #!/bin/bash
with the more portable #!/usr/bin/env bash
.
If a large number of files need to be changed, the following can be used to recursively patch all files in a directory.