Question

If you want to redirect output of a bash command into a file what operator will...

  1. If you want to redirect output of a bash command into a file what operator will you use?
  2. What does operator | mean in bash?
  3. What variable $0 contains in gawk?
  4. What variable $0 contains in bash script?
  5. What the statement esac means in bash script?

Homework Answers

Answer #1

1. To redirect the output of a bash command into a file, > is used followed by the file name. It creates a new file or overwrites the existing one. To append, use >> this operator.

For example: ls –l > list.txt will store the list of files of that directory to the list.txt file.

2. Operator | means pipe in bash. It is used to set the output of first command as the input of the next command.

For example: ls | grep ".txt" will show all the files of current directory which have .txt in them.

3. In gawk, $0 contains the whole line of input arguments.

4. In bash script, $0 contains the name of the script file that is being executed currently.

5. esac statement in the bash script is used to end the case block just like the fi is used to end if.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Bash script Suppose you are working as a prof or TA and your students have an...
Bash script Suppose you are working as a prof or TA and your students have an assignment which requires them each to hand in exactly one file. You've got a directory with all of the submitted files in it, and no other files. You're also lucky enough to have a script that will do all the work of marking a submission; it will take the name of a submission file as its only parameter and will print out a single...
Name the script args.sh. The script will take any number of command line arguments. The script...
Name the script args.sh. The script will take any number of command line arguments. The script will print (echo) each of the command line arguments on its own line, and will then print the total number of arguments entered. You should use the special shell variables. One special variable contains all the command line arguments. There is another one that contains the number of command one arguments entered. This script is most easily completed with a for loop, although the...
13) An output file stream object (ofstream) receives data and formatters using the stream insertion operator...
13) An output file stream object (ofstream) receives data and formatters using the stream insertion operator << in exactly the same way that the cout object does. True or False 14) The result of a read operation on an input file stream (ifstream) object is a boolean value indicating if the read succeeded or failed. True or False 15) A file stream object must be closed by the program after all the necessary reads or writes are completed. True or...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and the output in a word document and submit it. Part1: 1. Log in to Linux using your user account name and password. 2. If you logged in using a graphical login screen, open a terminal window by clicking on the icon in the lower left corner of the desktop to open the main menu, then selecting System Tools, then Terminal. A terminal window opens....
linux Using dpkg or apt, what would be the full command you would use to find...
linux Using dpkg or apt, what would be the full command you would use to find out if the python package was installed? This is tricky because Python’s actual package name is python3. $ If it is installed, what version is installed according to the dpkg or apt output? If it wasn’t installed, can you install it? What command would you use to do this? $ 2. Using dpkg, what would be the full command you would use to determine...
The first script you need to write is login.sh, a simple script that you might run...
The first script you need to write is login.sh, a simple script that you might run when you first log in to a machine. We'll expand this script later, but for now it should include your name, username, hostname, current directory, and the current time. Here is some sample output to help guide you. Note that the bolded lines that start with "[user@localhost ~]$" are the terminal prompts where you type in a command, not part of the script. Of...
What command do I use to run my pcap file through SNORT?
What command do I use to run my pcap file through SNORT?
1. Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal...
1. Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5 and log in to the terminal using the user name of root and the password of LINUXrocks!. 2. At the command prompt, type vi diskconfig.sh and press Enter to open a new file for editing called diskconfig.sh in your home directory. Why is it good form to use a .sh extension for shell scripts? 3. Enter the following text into the diskconfig.sh file. As you are typing the contents, ensure...
Finish this Code! We want to open a file called "names.txt" and display all of the...
Finish this Code! We want to open a file called "names.txt" and display all of the lines of the file as a list. Open the file in "reading" mode Use readlines to store the file into a list Use list indexing to display the 3rd item in the list This step is done for you! Close the file When you are finished, the output should match Desired Output. Notice: due to limitations with readine files in an online environment, the...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word " STREET" to the address, for all who live on 2nd or 3rd. For example: "2nd" becomes "2nd STREET" and "3rd" becomes "3rd STREET". Display only the first 9 lines. Hint: Use 2 sed statements with pipes. Task C Display all lines in famous.dat that end in 0 or 1, and have a 1 in the 3rd from the last column. For example lines...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • Write an M-File scripts that converts temperature in degrees Fahrenheit ( °F) to degrees Centigrade (...
    asked 5 minutes ago
  • Two spherical soap bubbles in air (with local pressure P0) come into contact and fuse to...
    asked 5 minutes ago
  • determine the combination of alkaline earth cations and test solution anions that produce a precipitate. Predict...
    asked 9 minutes ago
  • Homework of Unit Three 1. Situational Writing Situation: Value Link Co.,Ltd.(Add.:27 Srinakarin street,Bangkok,Thailand, Zip:10250, Fax:66-02-330-9765), deals...
    asked 20 minutes ago
  • Rothamsted Experimental Station (England) has studied wheat production since 1852. Each year, many small plots of...
    asked 29 minutes ago
  • 51. Which of the following type of dementia is the most common among all dementias A.Parkinsons...
    asked 30 minutes ago
  • A mad physicist assembled an EM wave generator. He claims that the generator is able to...
    asked 33 minutes ago
  • Question # 3: Solve the following conversions: a. %01000101 = ? (Decimal) b. 24510 = %____________...
    asked 46 minutes ago
  • 5. The Scientist-Practitioner model A. Focuses on the objective assessment of data only B. Focuses on...
    asked 49 minutes ago
  • 7) A disk is initially spinning about its center at 18 rad/s counter-clockwise and a constant...
    asked 49 minutes ago
  • -Two restaurants, Epicurean Eats and Dino’s Diner, operate in the same neighborhood. Epicurean Eats is a...
    asked 56 minutes ago
  • 1.What is the discount rate assuming the present value of $840 at the end of 1-year...
    asked 1 hour ago