Question

1) Write a single line UNIX command to list all sh files matching the multiple conditions...

1) Write a single line UNIX command to list all sh files matching the multiple conditions below: • at directory "/home/test" • filename containing "exam"

2) Write a single line UNIX command to check if "/home/exam2" in the PATH variable.

3) How to obtain the value of command line arguments in a shell program?

4) Write a single line UNIX command to run an executable Java program Hello at background and output the number of lines in the result.

5) Define a symbolic constant(macro) DATA to represent value 3.32 in C .

6) Write a single line UNIX command to output the returned value of last command.

7) In the format string %-8.3lf, explain the meaning of 8, 3 and lf respectively. And what will be printed for expression 123.3455 with this format string?

8) Rewrite the following loop so that its body is empty: for (i = 10; i > m; i--) m=i+m;

9) Rewrite the following if else statement so that only a single line statement is needed: if(n%5||n==3) return n; else return n+1;

10) What are the difference between [ $x == $y ] and [ $x -eq $y ]?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) find /home/test/ -name "*exam*.sh"

2) echo $PATH | grep -c /home/exam2

3) using $1 to get the first command line argument and $2 to get second, so on and so forth

5) #define DATA 3.32

6) echo $?

7) 8 represents total 8 character space will be reserved for the number, 3 represents only 3 character after decimal will be displayed and lf represent long float

8) for (i=10;i >m; i--){}

9) return (n%5||n-3)? n ; n+1

10) No difference

Add a comment
Know the answer?
Add Answer to:
1) Write a single line UNIX command to list all sh files matching the multiple conditions...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need some help with this UNIX problem: Write a single line UNIX command to mail only...

    Need some help with this UNIX problem: Write a single line UNIX command to mail only the process ID of running Java program test to the email test@fsu.edu

  • 1) Write a Unix command that will display the message below using echo and the value...

    1) Write a Unix command that will display the message below using echo and the value of your environment variable instead of the sample student login /students/astud01 My home directory is /students/astude01 2) Write a Unix command to display your login and the system date with both commands on one line (the output may be on separate lines) SAMPLE OUTPUT (details will differ): cconner Tue Jul 7 15:38:44 PDT 2015 3) 1.Write a Unix command that will redirect (>) the...

  • 10 pts) Write a single-line shell command that outputs the words in /usr/share/dict/words that begin with...

    10 pts) Write a single-line shell command that outputs the words in /usr/share/dict/words that begin with an uppercase A or an uppercase E, followed by any two characters, followed by a lowercase b, and ending with a lowercase a or a lowercase n Note that words greater than five characters in length are valid (i.e., there may be zero or more characters in between the lowercase b and the final lowercase a or lowercase n)! The command should append the...

  • Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text...

    Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text file by removing all blank lines (including lines that only contain white spaces), all spaces/tabs before the beginning of the line, and all spaces/tabs at the end of the line. The file must be saved under a different name with all the lines numbered and a single blank line added at the end of the file. For example, if the input file is given...

  • Star Database Program. This is a more sophisticated assignment, it will take longer to do. Write...

    Star Database Program. This is a more sophisticated assignment, it will take longer to do. Write a program which uses file IO, loops, and function calls. The following files are provided in pub: Assignment.cpp stars.dat solution_stars.dat solution.o when you log in the first time, make a directory for this project mkdir prog3 then copy down the files. (WARNING! This will overwrite any file in the directory named Assignment.cpp, so don't copy down Assignment.cpp if you have already done work): cp...

  • Write a full program that will accept any number of command line arguments and print them...

    Write a full program that will accept any number of command line arguments and print them to the screen. Suppose your program is called Print.java. When the command java Print hello goodbye you is run, the output will be hello goodbye you Write a full program that will accept exactly  three command line arguments that can be interpreted as integers, and will add them up. If there aren't exactly 3 command line arguments, print an error message and terminate the program....

  • How do I write a C program called binary that takes a single command line argument,...

    How do I write a C program called binary that takes a single command line argument, and integer, in decimal, and prints out the binary representation of the number with 64 bits. The argument must be stored as a long. Use atol to convert the command line argument. Include a function char *binary(long n, char *b) { ... } that stores the binary representation in the string b with '0's and '1's. It is the responsibility of the calling program...

  • Write a full program that will accept exactly  three command line arguments that can be interpreted as...

    Write a full program that will accept exactly  three command line arguments that can be interpreted as integers, and will add them up. If there aren't exactly 3 command line arguments, print an error message and terminate the program. Suppose your program is called Add.java. Then running the command java Add 1 2 3 will output 6, and running java Add, for example, will cause the program to shut down. Consider the following recursive method: public static int mystery (int n)...

  • Command line input In C++ it is possible to accept command line arguments. Command-line arguments are...

    Command line input In C++ it is possible to accept command line arguments. Command-line arguments are given after the name of a program in command-line operating systems like Linux and are passed in to the program from the operating system. To use command line arguments in the program, it must first understand the full declaration of the main function, which until now has accepted no arguments. In fact, main can accept two arguments: one argument is number of command line...

  • Using Unix/Linux Command line in terminal and C programming. (b) Write a basic C program contained...

    Using Unix/Linux Command line in terminal and C programming. (b) Write a basic C program contained in a1q4.c and perform the following tasks in your program’s main() function: (8 marks) • Declare and initialize at least one variable of these types: char, int, unsigned int, float, double and long double. When initializing your variables, ensure the constants you use are of the same type as your variable. See the “Constants” section of Topic 7 for more information. • Use printf(3)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT