Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need a little help with assignment Post 302902135 by bsn3971 on Monday 19th of May 2014 01:32:45 AM
Old 05-19-2014
Need a little help with assignment

Hello all im currently working on this assignment and a little stump on how to check for an argument heres the instructions:
Step 4:
Modify your script so that if there is an argument called TestError you display the following error message with your usage statement.
TestError found
Example:
$ ./template.sh xxx TestError zzz
Sun May 5 11:28:46 PDT 2013
xxx
*****
usage: ./template.sh argument ...
ERROR: TestError found
*****
zzz
*****
this is the current code im working with
Code:
# template.sh - edit this file
function usage
{
  echo "usage: $0 arguments ..."
  if [ $# -eq 1 ]
  then echo "ERROR: $1"
  fi
}

# Your script starts after this line.
if [ $# -eq 1 ]
then usage
else
name=""
echo $name
date
while [ $# -gt 0 ]
do
 if [ $# -gt 0 ]
 then
  arg=$1
  echo
  echo $1
  echo "*****"
 else
  echo
  usage "Could not find file $1"
 fi
 shift
 done
fi

any help/guidance would be appreciated thanks in advanced
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to do my assignment?????

my lecturer want to do an assignment about telnet server..first, he want us to download the telnet server..then he want we do about copy files and share files by using the telnet server....what is that??? and one more thing is how to do 'ping'???? (1 Reply)
Discussion started by: amelia
1 Replies

2. What is on Your Mind?

New Assignment

All Sys Administrators, With due respect I would like to know what should be BEST Things to do when LEAVING one job , and what Precaution MUST be taken while taking over new JOB?? Please Discuss in detail the STEP to be taken for both the TIME ?? (3 Replies)
Discussion started by: vakharia Mahesh
3 Replies

3. Shell Programming and Scripting

RE value assignment

Hi all How do I assign a pattern to a variable after a match is found using a regular expression in PERL? For example using a regular expression (RE) and matching as given if ($_ =~ /(?:\s*+\s*,)*\s*+\s*/) I want to assign the pattern matched by the RE to a variable. e.g. given the... (4 Replies)
Discussion started by: my_Perl
4 Replies

4. Shell Programming and Scripting

Help with variable assignment

Hi, In AIX I have a variable with , (coma) separated values assigned to it like shown below var1=apple,boy,chris i want to convert this to var1='apple','boy','chris' the number of values assigned to var1 might change and it could be from 1 to n any suggestions please? (3 Replies)
Discussion started by: rahul9909
3 Replies

5. Homework & Coursework Questions

could really use some help! Uli101 assignment 2

Continue here (0 Replies)
Discussion started by: vpundit
0 Replies

6. Homework & Coursework Questions

Uli101 assignment 2

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: # Create a BASH shell script called momo (My Own Music Organizer) # in ~/uli101.a2/ directory according to the... (9 Replies)
Discussion started by: Lunatic449447
9 Replies

7. Homework & Coursework Questions

Help with Java Assignment

1. The problem statement, all variables and given/known data: Hey there, I am currently working on an assignment which is due in on Monday 5th December and I am close to completing it, however there are two sections of the program I am running in which I am confused by. Basically I have created... (1 Reply)
Discussion started by: SilvarHawke
1 Replies

8. Homework & Coursework Questions

Assignment Help

1. List commands to create the directory hierarchy $HOME/a/b/c in vi to replace all occurences of TMP with tmp in lines 1 through 10 in vi to replace first occurence of CPU_file with DISK_file at line 15 2. Explain with a very simple example, usage of "ls -a" 3. What do the... (2 Replies)
Discussion started by: jessesaini
2 Replies

9. Shell Programming and Scripting

Help Assignment !! :D

Q-1 Write a shell script in Unix that lists files from your current working directory · By modification time when called with lm · By access time when called with la. By default, the script should show the listing of all the files in the current directory. Q-2 Write a... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies

10. Homework & Coursework Questions

Help Assignment !! :D

Q-1 Write a shell script in Unix that lists files from your current working directory · By modification time when called with lm · By access time when called with la. By default, the script should show the listing of all the files in the current directory. Q-2 Write a shell script which... (1 Reply)
Discussion started by: Vishank Parikh
1 Replies
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.10 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 04:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy