Question

Create a shell program called "myprog" that prints "Hello" (use echo). Remember it must start with...

Create a shell program called "myprog" that prints "Hello" (use echo). 
Remember it must
start with "Shebang" and the entire path to a bash shell. So you need at least 2 lines of codes, though
use a blank line between the two. Give the program rights so you have all the rights,
your group reading and driving rights, and everyone else just driving rights.
Now run your shell program. How can you run the program? Why is just the name for
command not enough? (Tip: check $ PATH - you need two characters before the command).
Specify:
1. the contents of your shell program
2. the command to set the permissions (test with other users if necessary)
3. a long list showing the rights to the program
4. command to run the program
arguments

Instead of the text "Hello", the first argument of the shell program should now appear. Then you have to
again use a special shell variable.
5. What do you need to use in your program to use the first argument? (2 characters)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1)
cat myprog
#!/bin/bash

echo Hello

Answer 2)

****7 for read,write,execute,5 for read and write,1 for execute only.

chmod 751 myprog

Answer 3)

ls -l myprog

Answer 4)
arguments

./myprog

Answer 5)
cat myprog

#!/bin/bash

echo $1

----To run the program
./myprog abcd

----output will be abcd

****$1 is used to display the first argument.

Screenshot

Add a comment
Know the answer?
Add Answer to:
Create a shell program called "myprog" that prints "Hello" (use echo). Remember it must start with...
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
  • 5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permi...

    5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permissions testdir/testdir_1/file1 where owner has read and execute permissions testdir/testdir_1/file2 where where owner has read, write and execute permissions. Group has read only permissions 7. Create a directory called newdir/newdir_1/newdir_2 copy the file testdir/testdir_1/file1 to this directory Change the permisions of the file to owner,...

  • Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...

    Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell variables, and .profile script file, echo SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME. Do not give just the value of...

  • Objective : Write a C Shell script which copies all files(*.java and *.class) from your home dire...

    Objective : Write a C Shell script which copies all files(*.java and *.class) from your home directory to a new one, and Analyze the new directory information such as number of files, user permissions, and disk usage. Sample Output:                                                    << CS Directory Analysis >>      Date:   ============================================================ Current Directory: /home/tomss New Directory Created : /home/tomss/pgm01 File information Total Number of files : 22 files Directory files:   0 files Plain text files:   10 files File have read permissions: 3 files File have...

  • You have just created a new Python program called example.py in your present working directory. Provide...

    You have just created a new Python program called example.py in your present working directory. Provide two minimal Linux shell commands that you need in order to see your program in action. Command #1: [permissions] Command #2: [execution]

  • I need this done ASAP. Please write a bash shell script that does the following: Prints...

    I need this done ASAP. Please write a bash shell script that does the following: Prints out how many users are logged on. This can be accomplished using who and wc. Prints out a list of currently logged on users. This can be accomplished using who, grep, regular expressions, and echo. Prints out how many processes you have running from past days, and a list of those jobs. Use `whoami` to get your username. Run ps -ef and see how...

  • Experiment with the terminal and C programming   I want you to be able to setup a...

    Experiment with the terminal and C programming   I want you to be able to setup a folder, change to a folder, create a new file with the editor (windows version is fine), rename files, delete files, and change permissions. How to create a compiled program Create your source code; lets say it is named test.c Compile it using: gcc test.c –o test Change the permissions to execute for everyone (755) Run it by: ./test Create two programs The first one...

  • I am a beginner in shell. Please help me with this question. question: In this assignment,...

    I am a beginner in shell. Please help me with this question. question: In this assignment, you will research into a few standard Unix utilities and leverage them in a shell script to perform a simple but useful task that's right up the alley of Unix shell scripting. As usual, you should aim for reasonably efficient algorithms and reasonably organized, comprehensible code. Consolidating log files My Internet chat software recording my conversations into daily log files, each named by date,...

  • 1) Echo the input: First, you should make sure you can write a program and have...

    1) Echo the input: First, you should make sure you can write a program and have it compile and run, take input and give output. So to start you should just echo the input. This means you should prompt the user for the plaintext, read it in and then print it back out, with a message such as "this is the plaintext you entered:". [4 points, for writing a working program, echoing the input and submitting the program on the...

  • In this exercise, you will create a script called file_ops.sh that uses the various file operators...

    In this exercise, you will create a script called file_ops.sh that uses the various file operators The file_ops.sh script will Use one command line argument Use four IF THEN statement to compare the first command line argument Determine which file operators to use that produces the following output when the script run with the arguments shown WARNING: In the IF THEN statements, to avoid syntax error messages, there must be a space before and after each bracket and also between...

  • If I have to run another program from within my program, is system (anotherProgram) a good call to use? (Hint: env vari...

    If I have to run another program from within my program, is system (anotherProgram) a good call to use? (Hint: env variables; difference b/w exec or its variants and system call.) Google if you don't know what 'env variables' means things like current to, just like command line arguments @ run time. env variables are that the program has access path, name of shell etc, If I have to run another program from within my program, is system (anotherProgram) a...

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