i am newbie and don't know much about bash.my instructor asked me to do cat script and observer the output and then tell What is > operator and what is the difference between > & >> operator? and i am unable to find any justifications.so,any help please :)
closed as off topic by John Gardeniers, Sirex, MadHatter, Tom O'Connor, Ward♦ Oct 17 '12 at 7:31
Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.
The ">" sign is used for redirecting the output of a program to something other than stdout (standard output, which is the terminal by default).
The >> appends to a file or creates the file if it doesn't exist.
The > overwrites the file if it exists or creates it if it doesn't exist.
In either case, the output of the program is stored in the file whose name is provided after the redirection operator.
$ ls > allmyfiles.txt creates the file "allmyfiles.txt" and fills it with the directory listing from the ls command
$ echo "End of directory listing" >> allmyfiles.txt adds "End of directory listing" to the end of the file "allmyfiles.txt"
$ > newzerobytefile creates a new zero byte file with the name "newzerobytefile" or overwrites an existing file of the same name (making it zero bytes in size)