shelllings

a practical way to learn shell
Log | Files | Refs | README | LICENSE

09_direction.sh (893B)


      1 #!/bin/sh
      2 
      3 # You can direct data to go where you want with these commands.
      4 #
      5 # $ echo "message" > file       # 'message' is the only data in the file
      6 #                                 if there is extra data, it is erased 
      7 # $ echo "message" >> file      # 'message' is ADDED ONTO the end of
      8 #                                 file with the previous data present
      9 # $ command 2> file             # only direct message errors into file
     10 # $ command 2>> file            # appends only error messages into file
     11 # $ command > file 2>&1         # directs standard output (>) and error
     12 #                                 messages (2>) into file
     13 # $ command >> file 2>&1        # same as before but appends
     14 #
     15 # Let's say for whatever reason you want to add all the contents of the
     16 # exercises/ folder and the license into one file. Fix the commands
     17 # below
     18 
     19 cat exercises >> 09_file
     20 cat LICENSE > 09_file