LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-18-2011, 09:08 AM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Rep: Reputation: 2
transport endpoint is not connected & if statement


Hi, my hdd sometimes disconnects from the nas by itself, that doesnt bother me. What I want is to write a script to test it:
Code:
# ls /usb/sdb1/
ls: /usb/sdb1/: Transport endpoint is not connected
This shows up when the hdd disconnects, I wonder if how I can use an if statement to get it:
Code:
output=$(ls /usb/sdb1/)
echo "$output"
if [ "$output" == "ls: .: Transport endpoint is not connected" ] ; then
	echo "yes"
fi
But there are no outputs.
Thanks,
Ted
 
Old 12-18-2011, 09:19 AM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Original Poster
Rep: Reputation: 2
Thanks, I found out how:
Code:
output="$(ls "/usb/sdb1/" 2>&1)"
if [ "$output" == "ls: /usb/sdb1/: Transport endpoint is not connected" ] ; then
	echo "yes"
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Log error: xinetd -Transport endpoint is not connected then Linux - General 2 01-02-2008 08:36 AM
getpeername failed. Error was Transport endpoint is not connected humbletech99 Linux - Networking 0 06-06-2006 12:47 PM
Dante client problem: control-socket: Transport endpoint is not connected phonic Linux - Networking 1 07-14-2004 04:46 PM
blastcl3- transport endpoint not connected?? help please lectrix Linux - Software 0 11-05-2003 10:14 AM
blastcl3: errno=107,Transport endpoint is not connected?? Help please. lectrix Linux - Networking 0 11-05-2003 09:25 AM


All times are GMT -5. The time now is 12:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration