M
M
mirus2014-08-01 10:10:11
bash
mirus, 2014-08-01 10:10:11

How to remove wrap in bash?

There is bash code

#!/bin/bash
#set -x
port=11100
while read -r line;
do
 IFS=";"
  set -- $line
sshpass -p "$3"  ssh -o StrictHostKeyChecking=no  -o UserKnownHostsFile=/dev/null  "$2"@"$1"  -C -N -D 95.24.25.15:$port -f  ;netstat -nltp | grep $port | awk '{print $4}' ;echo -e $1; port=$(($port+1));
done < ${1}

It reads from the access list and raises socks5.
And it outputs data to the file and it turns out that it echo -e $1puts a line break before, how to make it so that there is no line break?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2014-08-01
@miruss

ip=${ip//$'\n'/}  # Remove all newlines.
ip=${ip%$'\n'}   # Remove a trailing newline.
ip=$(echo $ip|tr -d '\n')  # Remove all newlines.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question