I don't know how to execute a command with a variable and get the result of this.
I have many .h
and .c
files and I need convert each from ISO-8859 to UTF-8.
So I make:
ls | grep "\.[ch]" | xargs myscript.sh
And in my script, the filename is in variable $1
. Now I need to perform
iconv -f ISO-8859 -t UTF-8 $1
and store result of this, because iconv
prints to stdout.
result=`iconv -f ISO-8859 -t UTF-8 $1`
echo $result
This seems to be not working, because it gives me some mismatch instead of converted $1
.