Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-21-2011, 03:47 PM   #1
LQ Newbie
Registered: Nov 2011
Posts: 1

Rep: Reputation: Disabled
Command errors vs. bash errors

Hi guys.
What are the differences between these two kinds of errors? (command error vs. bash error)
I'm an absolute newbie, so any help will be appreciated.

$ wc -l /etc/password
wc: /etc/password: No such file or directory
$ wc -l < /etc/password
bash: /etc/password: No such file or directory
Old 11-21-2011, 04:49 PM   #2
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
None really .. the error is displayed by the shell and shows the process that reported the error.

In the first case the process was 'wc' as it attempted to open the file.

In the second case it was 'bash' as it tried to open the file and feed it to 'wc' as input.
1 members found this post helpful.
Old 11-21-2011, 04:53 PM   #3
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,845

Rep: Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006Reputation: 2006
bash is, in the end, just another command. In the first line, the wc command is giving you an error, and in the second, it's the shell.

The reason for the difference is that in the first case bash launches wc with the filename passed to it as an argument. wc then looks for the filename that it was given, can't find it, and complains.

In the second case, you're using a redirection, which is a function of the shell. Now it's bash that's looking for the file, so that it can open it and send the contents into wc, and complaining when it can't be found.
1 members found this post helpful.


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
repeatable disk read/write errors with no errors logged by kernel or SMART mxl2 Linux - Hardware 9 04-02-2011 10:27 AM
yum update transaction check errors & mirror errors tonycunn Linux - Software 2 11-29-2010 09:16 AM
Bash script has errors smeezekitty Programming 30 11-19-2009 04:34 PM
Errors, Errors, and more Errors (KDE 3.4.x GUI Errors) Dralnu Linux - Software 2 05-13-2006 09:30 AM
bash errors after update JonathonReinhart Linux - Software 13 01-21-2006 01:48 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:58 PM.

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