Strange cat command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Strange cat command
# 1  
Old 09-23-2011
Strange cat command

What does the below statement means ?

cat "$1" > /tmp/file.$$ 2>/tmp/file0.$$

Please help.
# 2  
Old 09-23-2011
It says redirect the std output from the 1st positional variable into a temp file named file.$$ and redirect the std error to a temp file named file0.$$.
This User Gave Thanks to h@foorsa.biz For This Post:
# 3  
Old 09-23-2011
Thanks.
The files that are getting created in tmp directory are named something like file.<some number> and file0.<some number>.
Hence, I suppose file.$$ is used to created file with suffixed an unique numer.
Am I right ?
# 4  
Old 09-23-2011
The file is given an extension which is the PID of current shell that is running the special variable $$ holds such value.
$$ The process number of the current shell.
This User Gave Thanks to h@foorsa.biz For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Help need on cat command

I have two files as below 1.txt AA 123 CC 145 DD 567 2.txt AA 111 YY 128 CC 144 FF 222 DD 777 ZZ 875 basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below o/p (4 Replies)
Discussion started by: Tecnical_help12
4 Replies

2. Shell Programming and Scripting

Help need on cat command

I have two files as below 1.txt AA 123 CC 145 DD 567 2.txt AA 111 YY 128 CC 144 FF 222 DD 777 ZZ 875 basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below o/p (2 Replies)
Discussion started by: Tecnical_help12
2 Replies

3. AIX

cat command

Hi. How can i write a command on AIX like the one i did at linux that find string in a file and show me that string, and return 3 lines before and 4 lines after that string. my linux command is: /bin/cat <filename> | tail -150 | grep -B2 -A8 "<string to look for>" Example: /bin/cat ... (10 Replies)
Discussion started by: yechi_r
10 Replies

4. UNIX for Advanced & Expert Users

cat command

I believe I used the cat command to append a file beside another file (instead of below it) but I did not document it any where and I can't remember exactly how I did it. Has anyone else done this? I have tried all the cat options individually with no luck. It may be a combination of options. ... (2 Replies)
Discussion started by: nickg
2 Replies

5. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

6. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies

7. AIX

cat command

I would like to append some statement into 1 single file so that it can be concatenate together in 1 word. I have tried >> but it will seperate my 2 statement into 2 rows. # cat abc.txt cde.txt > result.txt where abc.txt is "abcde" and cde.txt is "12345" the result should come out as... (3 Replies)
Discussion started by: kwliew999
3 Replies

8. UNIX for Dummies Questions & Answers

CAT command

All - how do i save the file after i used CAT command line to modify? Thanks :confused: (2 Replies)
Discussion started by: March_2007
2 Replies

9. Shell Programming and Scripting

strange cat question.

Does anyone know what the microprograms behind cat (and other commands) are like? In what language are those programs designed? Is their source available somewhere? No particular reason, just wondering. I know it's a bit strange... (3 Replies)
Discussion started by: sanchopansa
3 Replies

10. Shell Programming and Scripting

the CAT command

hi everybody, how do i open a txt file writen in unix on to a web page so when i want to view the txt file that was generated from a shell program, that file is open on a web page do i use the cat > filename.html command to do this, or is there another way many thanks :D (2 Replies)
Discussion started by: alexd
2 Replies
Login or Register to Ask a Question