I have two scripts and wish to finish the labs in two days, I am not sure how to make these work though. Any help would be appreciated, a step by step guide would be great!
Q1)
Complete the following instructions and submit the questions and answers from this lab to your tutor. Please include the OS you used for this lab with your answer file.
Write a script that meets the following specifications:
States the name of the script and time of execution
Lists the script to the screen.
Gives the hostname
Gives the login name, UID, and "real name" of the user running the script
States how many arguments were given
For each argument, tests if the argument is a regular file, and if so, lists the file in long format (ls -l). If it's not a file, states that the argument either is not a regular file, or doesn't exist
Write a small C program that only runs this script. Hint: the C program uses a certain system function call, also called system call. Submit details of creating, compiling, linking and running this program.
Sample output from two different invocations:
In my version of the script, I used echo, date, hostname, grep, cut, a for loop, if-then-else, test, and ls
Read the man pages and experiment to figure out how to do this. One hint -- the following will put the GID into a variable called 'gid'
Submit your script
Submit a sample output from your script
Q2)
Complete the following instructions and submit the questions with answers from this lab to your tutor. Please include the OS you used for this lab with your answer file.
Create the following script as /tmp/lab6.sh.
env Run /tmp/lab6.sh from the command line, and take a look at the output. Now run /tmp/lab6.sh using the at command.
Show the complete command used. How does the output of the at version differ from the output of the command line version? (Hint: the diff command might be useful to you.) -- 2pts Run the command from cron, as user root.
Show the complete procedure used. How does the output differ from the command line output? -- 2pts Run the command from cron, as another user (either one from the previous lab, or one you create for this purpose).
How does this output differ from the output when run as root from cron? -- 2pts Try to set up a crontab that contains errors.
What error did you put into the crontab, and what happened? -- 2pts See if you can submit an at job to run in the year 2029
What happened? Why? -- 2pts Clean up after yourself. Use at -l to get the name of your at jobs, and use atrm to remove the job. Edit your crontab files to remove your entries.
Please guide me thru these two cz I have no idea how to even begin!!!
Last edited by zaxxon; 08-31-2011 at 07:28 AM..
Reason: novel-like subject
Hi,
Background: There are 2 servers server1 and server2
In server1 i have my script to perform a functionality from the script in server1 i m calling a script named action in server2. The script action has to check the size of a file in a particular location in server1, if the size of the file... (1 Reply)
If there's anywhere to look this up, it would be just as helpful. I googled and really couldn't find anything relative to this.
ok... General Variables
1) When creating a script I made a file "prog1.sh" does it matter if the end is .sh or is this what has to be done like prog.bash or... (4 Replies)
1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files
I have written a small script which i used to check for the existing users and their password.
What I need help with:
I have a set of questions in a... (19 Replies)
I have a file like this. Pls help me to solve this.
08-24-2010 10:22:34,xxxxxxxxMessage : 111
08-24-2010 10:24:38,xxxxxxxbMessage : 000
08-24-2010 11:28:11,xxxxxxxcMessage : 111
08-24-2010 11:32:35,xxxxxxxdMessage : 111
08-24-2010 11:32:35,xxxxxxxeMessage : 111
(I should look for Message... (1 Reply)
Hi
How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
1. Can anyone explain me what the line
x=signal(SIGINT,nh);
does?
2. How do I write a command to print the longest line in a file?
3. How do I write a command to print the last word of every line of a file using sed?
4. What exactly does this line do?
:%s/^\(\)\(\)/\2\1/g^M... (3 Replies)
hello everyone, i have a couple of questions about programming with shell scripts.
-My question is, how do you find out how long a sequence of numbers that has just been entered is. for example
If i enter 12345 the length here is 5
and 23456789 the length here is eight.
I want to be able... (1 Reply)
can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files...
pls someone help me on this...
thanking in anticipation.... (1 Reply)
did a search but was not allowed to use 'ftp' because its too short of a word.
for some reason, i can't seem to remember anything about ftp shell scripts - would someone please refresh my memory on the syntax and maybe give a short example? thanks for the time. (5 Replies)