I had use for this today and decided to share it in case someone else needs something similar.
Example:
This script has not been heavily tested so think twice about using it for mission critical applications. Please do add your comments, criticisms and improvements below.
Code:
#!/bin/bash
count=0
name=""
for word in $@
do
if [ $count -ge 1 ]
then
name+="_" # replacement character
fi
name+="$word"
count=$((count + 1))
done
echo "$name"
Code:
$ ./repspc Space the final frontier Space_the_final_frontier


Comment