#!/bin/sh
read -p "Enter sequence: " seq
for char in $seq; do
echo "$char"
done
I read sequence of "characters" from standard input. For example let it be 1234(),
I want to change it to be like this:
'1' '2' '3' '4' '(' ')' ','
I don't want to echo this sequence. I need it to has this new value.
Is it possible in standard sh script ?
You can split the string with sed
(1):
seq=`printf "%s\n" "$seq" | sed 's/./ &/g'`