Hi,
I just arribe to c shell programming! Could you please help me with the following exercises or where find solutions in cshell:
1.- Write a script that would display the time when run.
2.- Write a script that would wait 5 seconds, then display the time, but 5 seconds late. Hint: use the "sleep" command.
3.- Write a script that will take a person's name as a parameter to the program name. The script should greet that person, as Good Day name_entered, How are you today?
4.- Write a script that will prompt the user for a name. That same name will then be displayed in the same format as the previous exercise.
5.- Write a script that will return the number of parameters on the command line.
6.- Write a series of scripts that will count the number of parameters on the command line, first using the for statement, then the while and finally the until statement. (Three scripts).
7.- Write a script that will echo the third parameter, but only if it is present.
Given a file of numbers (one per line), write a script that will find the lowest and highest number.
8.- Write a script that would recognize if a word entered from the keyboard started with an upper or lower case character or a digit. Use the "case" statement.
The script would then output the word, followed by "upper case", "lower case", "digit", or "not upper, lower, or digit".
9.- Write a script that would first verify if file "myfile" exists. If if does not, create it, then ask the user for confirmation to erase it...
10.- Write a program that will calculate the amount of disk space your directory is using on the system.
Hint: the program could use both the du and awk commands.
11.- Write a program that will list the files you have in the current directory, followed by the directories. The output should have the form:
Files:
------
filenames
Directories:
------------
directories
12.- Write a program to verify how many users are logged on to the system.
13.- Write a program that will take an undetermined list of parameters, and reverse them.
Thanks in advance!
Guido
4 2077
I would love to help, but I need you to read our policy on homework questions first.
After doing that, please let us know what you have done so far, and what you are having problems with.
I would love to help, but I need you to read our policy on homework questions first.
After doing that, please let us know what you have done so far, and what you are having problems with.
Ok,
So can you help me with this:
"Write a script that would recognize if a word entered from the keyboard started with an upper or lower case character or a digit. Use the "case" statement.
The script would then output the word, followed by "upper case", "lower case", "digit", or "not upper, lower, or digit".
I suspect i have to use:
set fname = `echo $i |tr "[A-Z]" "[a-z]" `
or
foreach fn ( *.txt )
mv $fn `echo $fn | gawk '{print tolower($0)}'`
end
Or maybe
ls *.txt | gawk '{system("mv " $0 " " tolower($0) )}'
Thanks
Guido
Ok,
So can you help me with this:
"Write a script that would recognize if a word entered from the keyboard started with an upper or lower case character or a digit. Use the "case" statement.
The script would then output the word, followed by "upper case", "lower case", "digit", or "not upper, lower, or digit".
I suspect i have to use:
set fname = `echo $i |tr "[A-Z]" "[a-z]" `
or
foreach fn ( *.txt )
mv $fn `echo $fn | gawk '{print tolower($0)}'`
end
Or maybe
ls *.txt | gawk '{system("mv " $0 " " tolower($0) )}'
Thanks
Guido
your homework states to use the case statement. See here for examples
Ok,
So can you help me with this:
"Write a script that would recognize if a word entered from the keyboard started with an upper or lower case character or a digit. Use the "case" statement.
The script would then output the word, followed by "upper case", "lower case", "digit", or "not upper, lower, or digit".
I suspect i have to use:
set fname = `echo $i |tr "[A-Z]" "[a-z]" `
or
foreach fn ( *.txt )
mv $fn `echo $fn | gawk '{print tolower($0)}'`
end
Or maybe
ls *.txt | gawk '{system("mv " $0 " " tolower($0) )}'
Thanks
Guido
Okay, do any of those give you what you are looking for? I would suggest you take a look at the man pages for the tools you are calling.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paddy McCarthy |
last post by:
This is really a comment on "Python in Systems Administration: Part I
-- Better Scripting"
http://www.samag.com/documents/s=8964/sam0312a/0312a.htm
by Cameron Laird.
Reading the article,...
|
by: apropo |
last post by:
what is wrong with this code? someone told me there is a BAD practice with
that strlen in the for loop, but i don't get it exactly. Could anyone
explain me in plain english,please?
char...
|
by: John Salerno |
last post by:
I'm interested in trying out shells other than IDLE, and I found
PyShell, but I'm not sure how to get it exactly. Is there a way to get
it without installing wxPython, or is it a part of it? I...
|
by: mp |
last post by:
i have a python program which attempts to call 'cls' but fails:
sh: line 1: cls: command not found
i tried creating an alias from cls to clear in .profile, .cshrc, and
/etc/profile, but none...
|
by: dmh2000 |
last post by:
I am experimenting with the interactive interpreter environments of
Python and Ruby and I ran into what seems to be a fundamental
difference. However I may be doing something wrong in Python....
|
by: will |
last post by:
I have an XML input that includes things like:
<foo>line of text
another line of text
yet another</foo>
And I want the
entities PRESERVED (not translated) on the result,
so:
<bar>line of...
|
by: vinot85 |
last post by:
Hi friends,
I need to know why UNIX systems are having different types of shells like Bourne, Korn, C, Tcsh..etc?Why Cant the Operating system can work and interpret thew user commands using a...
|
by: Mrown |
last post by:
Hi,
I'm currently writing a python program that relies on a CLI
program. What I'm currently doing is using subprocess.Popen on Python
2.5.1. Here's the line that I'm currently running:
child...
|
by: madha128 |
last post by:
Why multiple shells are used in Linux, even born_again (Bash) the default shell is able to operate all the functions??????
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |