Welcome to the most active Linux Forum on the web.
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 08-25-2006, 02:10 AM   #1
Registered: May 2006
Posts: 55

Rep: Reputation: 15
redirection < operator not working pls help

Redirection operator < is used to read input from a file to a command.

I tried
$cal < myfile

myfile contains data:

but the above command is not working. I wanted to make the cal command read input from the file 'myfile' and display the calendar of year 2000. I am using the I/O redirection operator in the above command. Why the above command is not working? How to make it to work??

pls help,

thanks in advance.
Old 08-25-2006, 02:42 AM   #2
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 31
cal does NOT read from stdin. The < operator sends the contents of the specified file to the standard input (stdin) of the specified program. Since cal does not read from stdin, this will not work. Check the cal manpage (man cal).

If you want to print the calendar for 2000, just do:
cal 2000
If you really must read this year from a file, do:
cal $(<myfile)
Which will read from myfile, and pass the contents as arguments to cal.

Last edited by zhangmaike; 08-25-2006 at 02:43 AM.
Old 08-25-2006, 03:32 AM   #3
LQ Newbie
Registered: Aug 2006
Location: Beijing China
Distribution: RedFlag
Posts: 6

Rep: Reputation: 0
thank you!that is my problem too.
Old 08-25-2006, 03:35 AM   #4
LQ Newbie
Registered: Aug 2006
Location: Beijing China
Distribution: RedFlag
Posts: 6

Rep: Reputation: 0
thank you!
that is my problem too.


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
(C++) vector assignment operator not working??? R00ts Programming 5 06-16-2005 12:39 PM
my samba suddenly is not working pls help sibu_rajappan Linux - Networking 0 06-07-2004 05:31 AM
pls pls pls help me ! i'm tired with httpd config on fedora apache 2.0.48 AngelOfTheDamn Fedora 0 01-24-2004 06:12 PM
IO redirection not working ministre Linux - Newbie 2 11-04-2003 02:50 PM
Getting Internet Working!?!? HELP PLS sammyd56 Linux - Newbie 3 09-23-2003 04:33 PM > Forums > Linux Forums > Linux - Newbie

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

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