Pavan
(Pavan ..)
1
I am trying to run simple shell commands in my script, but am unable to
get rid of new lines even using chomp or chop.
Is there something I am missing ?
u=`echo '#{l}' | cut -d: -f4`.chop()
p2=`echo '#{l}' | cut -d: -f3`.chop()
p1=`echo '#{l}' | cut -d: -f2`.chomp()
h=`echo '#{l}' | cut -d: -f1`.chop()
# **Cant get newlines to go !! ??**
path="#{p1}/#{@CODELINEFILTER}#{p2}"
puts path
Any suggestions ?
···
--
Posted via http://www.ruby-forum.com/.
You might try using
echo -n
and sidestep the problem completely.
Dan Nachbar
···
On Sep 23, 2011, at 2:36 PM, Pavan .. wrote:
I am trying to run simple shell commands in my script, but am unable to
get rid of new lines even using chomp or chop.
Is there something I am missing ?
u=`echo '#{l}' | cut -d: -f4`.chop()
p2=`echo '#{l}' | cut -d: -f3`.chop()
p1=`echo '#{l}' | cut -d: -f2`.chomp()
h=`echo '#{l}' | cut -d: -f1`.chop()
# **Cant get newlines to go !! ??**
path="#{p1}/#{@CODELINEFILTER}#{p2}"
puts path
Any suggestions ?
I’m somewhat confused as to why a more rubish construct like:
u,p2,p1,h = l.split(‘:’)
is not more appropriate?
···
On Sat, 24 Sep 2011 04:03:59 +0900, Dan Nachbar wrote:
On Sep 23, 2011, at 2:36 PM, Pavan … wrote:
I am trying to run simple shell commands in my script, but am unable to
get rid of new lines even using chomp or chop.
Is there something I am missing ?
u=`echo '#{l}' | cut -d: -f4`.chop()
p2=`echo '#{l}' | cut -d: -f3`.chop()
p1=`echo '#{l}' | cut -d: -f2`.chomp()
h=`echo '#{l}' | cut -d: -f1`.chop()
Cant get newlines to go !! ??
path="#{p1}/#{@CODELINEFILTER}#{p2}"
puts path
Any suggestions ?
You might try using
echo -n
and sidestep the problem completely.
Dan Nachbar