ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Thats close, I need to get rid of the space between the begining of the word on the next line and the end of the word on the line above it. So that where the word ends the next space on the line below it is where the next word will start
Originally posted by vsop That won't work with regular spaces. It works fine with the '=' char, but if you replace it with a blank spaces it does not work
True.
But to fix this, you only need to put double quotes around ${SPACES:0:$NR}.
Then it does work.
Code:
SPACES=" "
NR=0
ARG=$1
while shift ; do
echo $ARG
NR=$((NR+${#ARG}))
ARG=$1
test -z $ARG || echo -n "${SPACES:0:$NR}"
done
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.