Results 1 to 4 of 4
I created a simple bash script. My primary concern is how to remove the new line in the output of my script in /root/test.txt
Synopsis
./script.sh foo fee
Content
case ...
- 11-25-2009 #1Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
how to remove new line in bash using echo
I created a simple bash script. My primary concern is how to remove the new line in the output of my script in /root/test.txt
Synopsis
Content./script.sh foo fee
The output of this iscase $1 in
*)
echo -ne "
$1
$2" > /root/test.txt
I want to remove the new line above the foo. Is it possible?
foo
fee
- 11-25-2009 #2Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
Problem fixed.
I didn't notice the '"' that it should follow $1 and forgot to remove remove -e
- 11-25-2009 #3Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
forgot to ask this.
Can I make it short that instead of writing
Is there a way I can shortened the portion $2 $3 $4 $5 $6 $7 $8 $9 up to variable I want let's say $100.case $1 in
*)
echo -ne "
$1
$2 $3 $4 $5 $6 $7 $8 $9" > /root/test.txt
I though $[2-100] is ok but instead it do an arithmetic which was $98.
- 11-25-2009 #4Just Joined!
- Join Date
- Aug 2005
- Posts
- 65
can this line do it ?Code:for((i=2;$i<$#;i++)) do echo -n "$i "; done > /root/test.txt


Reply With Quote