Reputation: 822
I am using /bin/sh to write a shell script that fetches data from a telnet call via ncat, like so:
echo 'transport info' | ncat hostname 9993
When I do this from a command line the output looks like this:
500 connection info:
protocol version: 1.3
model: HyperDeck Studio
208 transport info:
status: record
speed: 0
slot id: 1
clip id: none
display timecode: 00:28:01:27
timecode: 00:00:00:00
video format: 1080i5994
loop: false
But when I do it in a shell script /bin/sh
it looks like this:
loop: falseat: 1080i599443:15
Here is my sample script:
#!/bin/sh
FOO="$( echo "transport info" | ncat -C hostname 9993 )"
echo $FOO
Anyone know why this happens?
Upvotes: 0
Views: 150
Reputation: 822
#!/bin/sh
echo "transport info" | ncat -C hostname 9993 | dos2unix > /tmp/test.txt
cat /tmp/test.txt
Output:
500 connection info:
protocol version: 1.3
model: HyperDeck Studio
208 transport info:
status: preview
speed: 0
slot id: none
clip id: none
display timecode: 01:10:01:01
timecode: 00:00:00:00
video format: 1080i5994
loop: false
Upvotes: 1