Linked Questions

2
votes
1answer
3k views

what is the difference between >&2 and &>2 [duplicate]

Just wondering if there is any difference between: echo "running the npm patch" >&2; and echo "running the npm patch" &>2; I have actually never really understand that syntax.
1
vote
1answer
7k views

What is the different between ls > list and ls >> list? [duplicate]

I was wondering what the difference is between ls > list and ls >> list is and what the purpose of these commands is?
1
vote
2answers
2k views

How does (echo 'text' ; cat file.txt ) > new file.txt actually work? [duplicate]

So, here's a simple code: (echo "Some text to prepend"; cat gero.txt) > file.txt And I can't really grasp the mechanics of this code. So basically gero.txt is an already existing file, we create ...
1
vote
1answer
3k views

What is the behaviour of & operator [duplicate]

I am trying to chain the commands in linux, I am using ubuntu 14.04 distribution. The aim to create a directory and go into that directory. Generally we do this mkdir foldername cd foldername ...
0
votes
2answers
4k views

How to redirect unzip -v output to a log file in shell script [duplicate]

I have a script that loops through all zip files in a large directory and individually unzips them. I am using the -q option in order to keep the console clean and display other monitoring info. I ...
2
votes
3answers
1k views

what is the use of '<<' redirection? [duplicate]

I am looking for an example of << redirection because i don't understand it well. I know < is for sending the contents of specified file to be use as standard input like : cat < file.txt ...
0
votes
1answer
2k views

How to make a bash script run all the time [duplicate]

Just curious how I can make a bash script run not only when I call it but all the time in the background. I have a bash script that is supposed to look for files and place them in the right folders, ...
3
votes
2answers
299 views

Linux redirection: << operator [duplicate]

Can anyone explain when and how to use << operator for input redirection? I've googled enough but couldn't find.
1
vote
2answers
1k views

How to run shell script in background while start On CentOS? [duplicate]

I have a shell script contain loop like this: while true do if ... ; then ... else ... break fi done I want this script to run backend while OS start. I have try to add this script ...
0
votes
1answer
2k views

What does this ls command do? [duplicate]

what does this command do if it was executed in my current working directory that has files in it? ls 2> result I think whatever ls writes will be redirected to the result file? Is that correct and ...
0
votes
1answer
519 views

Piping to file doesn't work with intermediate pipe [duplicate]

This is causing problems: node "$SUMAN_PROJECT_ROOT/server.js" | bunyan -o short &> ${LOG_FILE} & this works: node "$SUMAN_PROJECT_ROOT/server.js" &> ${LOG_FILE} & the ...
2
votes
2answers
947 views

How to redirect command output and error to two different files? [duplicate]

I want to redirect output of a tar command to one file say, out.log and errors during execution should be redirected to another file for example, error.log. How can I achieve this?
3
votes
2answers
113 views

Order of commands executed and redirection [duplicate]

For a bash script I'm making, I need to delete all but the newest 2 files in a directory. I decided to use ls -tUr > somefile.txt and then just tail the newest 2, move them somewhere else, rm *, ...
-3
votes
3answers
775 views

“Make sure not to read and write the same file in the same pipeline” [duplicate]

shellcheck reports: echo -e "blah/blah\n$(cat "$tmpdir"/"$filename".jpdf)" > "$tmpdir"/"$filename".jpdf ^-- SC2094: Make sure not to read and write the same file in the ...
2
votes
1answer
913 views

Unable to redirect stdout/stderr to log file [duplicate]

I have a script tmp.sh #!/bin/bash echo hello sleep 3 echo 3 I want to log the script running time (as well as script stdout) to a log file. user$ time ./tmp.sh >& log.tmp real 0m3....

15 30 50 per page