Replace single quotes for strings divided by blank space from variable
1
vote
1
answer
855
views
I'm writing a bash script where I'm reading in a variable via
read
this two strings:
log.*.console.log log.*.log
They are separated by space.
How can I rewrite the strings that the output from the variable for the next program called in the script will have them in this form ? 'log.*.console.log' 'log.*.log'
I was trying sed and awk but somehow without success.
The whole script:
#!/bin/bash
if [ -z "$*" ] ; then
echo "USAGE: ./some text"
exit 1
else
echo "some text"
read varlogname
i=1
for file in $@
do
echo "Doing" $file
GTAR=$(gtar -xvf $file --wildcards --ignore-case --no-anchored "$varlogname")
for file in ${GTAR[*]}
do
mv $file $file"."${i}
i=$((i+1))
done
done
echo "Files extracted."
fi
exit 0
Asked by DaWe4444
(123 rep)
Apr 10, 2017, 08:10 AM
Last activity: Apr 10, 2017, 09:01 AM
Last activity: Apr 10, 2017, 09:01 AM