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 [email protected]

  • 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....

  • 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)...

  • This is being done in c using command line in Linux 1.1 llist: Linked list Write...

    This is being done in c using command line in Linux 1.1 llist: Linked list Write a program llist that maintains and manipulates a sorted linked list of integers according to instructions received from standard inpu. The linked list is maintained in order, meaning that each integer will be larger than the one preceeding it. 1list maintains a linked list containing zero or more integers, ordered from least to greatest llist will need to allocate space for new nodes as...

  • C programming Question1 (a) Write a C program that will print out all command line arguments,...

    C programming Question1 (a) Write a C program that will print out all command line arguments, in reverse order, one per line. Prefix each line with its index. 6 marks] (b) Consider this C code snippet int a- 100 int b- 42; inte p- &a; int q-b; p qi printf ("%d %d\n" ,a,*p); When this code is executed, what numbers will it print? [2 marks] (c) Consider this C program int main(int argc,char argv) char* target- "Apple" char vord[100] printf...

  • Unix/Linux The purpose of this lab is to practice the commands to manage and organize files...

    Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...

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
ADVERTISEMENT