Function Issues

I am converting English letters/words/punctuation in leet speak. My current script works just fine, but when I call the functions it seem to be bypassing my second function altogether. I am new to shell scripting so excuse me if its an easy fix.

Also, when using SED for whole word phrases like 'are' or a punctuation mark like '.' is sed -e still appropriate or should I be using another command like -i (insert)?

Thanks.

#!/bin/bash

INPUT=$@ 
echo 'Enter String'


standard()
{
sed -e 's/a/4/g' -e 's/b/8/g' -e 's/c/(/g' -e 's/d/|)/g' -e 's/e/3/g' -e 's/f/ph/g' -e 's/g/9/g' -e 's/h/#/g' -e 's/i/!/g' -e 's/j/;/g' -e 's/k/x/g' -e 's/l/1/g' -e 's/m/^^/g' -e 's/n/~/g' -e 's/o/0/g' -e 's/p/|*/g' -e 's/q/0_/g' -e 's/r/|2/g' -e 's/s/5/g' -e 's/t/7/g' -e 's/u/|_|/g' -e 's/v/\//g' -e 's/w/vv/g' -e 's/x/></g' -e 's/y/j/g' -e 's/z/2/g' $INPUT
}


word ()
{
sed -e 's/ee/ea/' $INPUT
}

word
standard;



exit

To me it seems you had simply forgotten the trailing g for sed within the word function :wink:

hth

Sure it's bypassed? Or, as it is called first, could it be overwritten? You are running both functions on the same unmodified input.

Script is fine you need to call the script with file as argument .
sh shell_script.sh input_file
if you wish to get the input conversion, rather using $INPUT at end of sed use echo statement will do the result

read INPUT
echo $INPUT |sed ...

That what I was thinking. Do I need to make another variable? For example, 'input2'. It is definitely overwriting whatever function I call first.

---------- Post updated at 04:15 PM ---------- Previous update was at 04:12 PM ----------

Thank you I will try this and let you know if it works. I am expecting user input not a file, would that have any effect on the example you provided?