I'm new to Linux and have recently started working on my very first (very simple) project - a morse code generator. I've been able to get the translation working, and now I want to take the next step.
What would be the best way to go about replacing the character "." with a beep and "-" with a slightly longer beep? I would like to be able to actually produce audible morse code.
Which way would you more advanced users go about doing this? If you have any ideas, please explain in as simple terms as you can.
NOTE: My code is here on pastebin: http://pastebin.com/K5Ap3p4S.
echo
echo "What would you like to translate today?"
read transmission
clear
echo $transmission | sed 's/.\{1\}/& /g' | sed 's/a/.-/g;
s/b/-.../g;
s/c/-.-./g;
.
to a beep, without seeing your code your question is then a bit too broad to answer ATM. If you're looking to do a search/replace in Bash, you can either use sed to accomplish this or Bash's native regex facilities. – slm Mar 31 '16 at 07:21sed
script contains completely unnecessary curly braces.s/.\{1\}/& /g
should just bes/./& /g
. – Wildcard Apr 03 '16 at 07:49