How does $(<file) work?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How does $(<file) work?
# 1  
Old 04-07-2009
How does $(<file) work?

If you enter " < myfile " on shell prompt directly, nothing to output. But for ' $(< myfile) ' , the contents of myfile replace $(< myfile). That has the same effect as ' $(cat myfile) '. I never seen such usage before and dont know how $(< myfile) work. Anyone can give some explanation?
# 2  
Old 04-07-2009
'man ksh' yields:
Code:
  Command Substitution
     The standard output from a command enclosed  in  parenthesis
     preceded by a dollar sign (that is, $(command)) or a pair of
     grave accents (``) may be used as part or  all  of  a  word.
     Trailing  new-lines  are  removed.   In the second (archaic)
     form, the string between the quotes is processed for special
     quoting  characters  before  the  command  is executed. (See
     Quoting below.) The command substitution $(cat file) can  be
     replaced by the equivalent but faster $(<file). Command sub-
     stitution of most  special  commands  that  do  not  perform
     input/output  redirection are carried out without creating a
     separate process.

 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. IP Networking

Discussion at work, would a router work pluging a cable in wan1 and lan1?

hi all. and sorry for the random question, but this sparkled a raging flame-war at work and i want more points of view situation a router, with linux of some sort, dhcp client requesting for ip in wan1 (as usual with wan ports) dhcp server listening in lan1, and assigning ip (as usual... (9 Replies)
Discussion started by: broli
9 Replies

2. Shell Programming and Scripting

My script work on Linux but not work in sunos.

My script work on Linux but not work in sun os. my script. logFiles="sentLog1.log sentLog2.log" intial_time="0 0" logLocation="/usr/local/tomcat/logs/" sleepTime=600 failMessage=":: $(tput bold)Log not update$(tput rmso) = " successMessage="OK" arr=($logFiles)... (7 Replies)
Discussion started by: ooilinlove
7 Replies

3. UNIX for Dummies Questions & Answers

Need to work in a file

I have a file like this: 00510010 0000000471 000000000482.90 000000005855.49 00510015 0000000471 000000002280.81 000000003093.79 00510020 0000000471 000000023640.82 000000022857.28 00510021 0000000471 ... (4 Replies)
Discussion started by: Adhi
4 Replies

4. UNIX for Dummies Questions & Answers

How do unix file lenghts work?

Hello, Can someone tell me how unix works out file lenghts please? If I'm ftp'ing a file from a mvs mainframe to a unix box will the file be replicated line by line? I'm looking at the file on the unix box and it's telling me the recl is almost 4000 but it's not that on the mvs side. Should a... (3 Replies)
Discussion started by: Grueben
3 Replies

5. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies
Login or Register to Ask a Question