Sponsored Content
Homework and Emergencies Homework & Coursework Questions bash error checking problems[solved] Post 302714165 by kevin298 on Thursday 11th of October 2012 11:28:42 PM
Old 10-12-2012
bash error checking problems[solved]

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: I am trying to make a script called showtime that displays the current time for a given city.
The problem is on the error checking part im trying to make the script search a directory called zoneinfo to see if the region or city the user entered exist.
2. Relevant commands, code, scripts, algorithms:
# Declear Varables
region=$1
city=$2
#Checking if region exist in the database
region=$(ls ~/zoneinfo| grep '$1')


3. The attempts at a solution (include all code and scripts):
# Declear Varables
region=$1
city=$2
#Checking if region exist in the database
region=$(ls ~/zoneinfo| grep '$1')

if [ '$1' == "" ]; then
echo $1 does not exist
exit 2
fi



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):Seneca College professor name John selmy/course name OPS 435

your website wont let me post the url to the courses sit for some reason??


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 10-12-2012 at 06:03 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error checking in bash

Could someone please advise on a good way to implement error checking in a script? i am taking input from a file, iserting it's values into two commands and sending the output of each to seperate log files. i need to check those log files for for an occurance of 'error', stop the command if... (3 Replies)
Discussion started by: gubten
3 Replies

2. UNIX and Linux Applications

Kudda has successfully solved the downloading problems for numerous video web

The rise of Video web stimulates more intuitive video feeling of large people, and makes video downloading becomes a popular trend in web times, meanwhile, more and more downloading problems arises correspondingly, in which the first trouble is slow downloading speed and incomplete downloading. It... (0 Replies)
Discussion started by: angelstar
0 Replies

3. Shell Programming and Scripting

bash if loop for checking multiple parameters

Hello, I've got next problem: I want to examine at the beginning of a script in an if loop that: 1. Is there 4 parameters given 2. If first state is true then: is there switches -e and -d? 3. At the end, how can i indentify them as variebles regardlees to its order. I was thinking like... (2 Replies)
Discussion started by: szittyafergeteg
2 Replies

4. Shell Programming and Scripting

bash: checking file size -solved

Hello I have srv RHEL5, file system UTDM (EMC DiskXtender Unix/Linux File System Manager 3.5 & EMC Centera). it all works under the scheme: have disk is formatted with a file system UTDM, drive open network - NFS, it write data, then migrate the data in the repository - EMC Centera. There are... (0 Replies)
Discussion started by: moskovets
0 Replies

5. Shell Programming and Scripting

[Solved] <<EOF error checking

I am trying to check the return status of a command thats encapsulated in an <<EOF #!/bin/ksh set -x xxx() { set -x ls -lt /tmp/jdlkewjdlkewjdlkewjdlewjdlew<<EOT ret=$? EOT echo "ret=$ret" } >>$LOG 2>&1 LOG=/tmp/t2.out rm -rf $LOG echo "Starting process `date... (2 Replies)
Discussion started by: BeefStu
2 Replies

6. AIX

problems connecting with exceed (solved)

Hi, We have a user who cannot connect to the aix system anymore with hummingbird exceed. Our unix servers are aix 5.3. She is running windows xp and using hummingbird 12. She used to not have any problem, but now when she tries to use xstart she gets an error 'unable to connect to host using... (0 Replies)
Discussion started by: fwellers
0 Replies

7. HP-UX

Solved -- Problems with NIS Password Expiration...

HI. I was wondering if anyone can assist me in this. I have an HP-UX 11.31 server at work which keeps expiring my NIS password. I cannot log in unless I use root access. It worked before and I think some of the settings changed since then. My boss has told me that since we're taking some... (1 Reply)
Discussion started by: zixzix01
1 Replies

8. Shell Programming and Scripting

Multiple condition checking in bash

Hi All, I am trying to check if two variables have value assigned to it. i am doing it like if ] then echo "Please specify either single hostname or host file for the report" usage exit fi But its not working for it.Even i specify values for both variables it dont go... (6 Replies)
Discussion started by: kailash19
6 Replies

9. Shell Programming and Scripting

checking first argument for tag in bash script

I have a bash script where I pass an argument ./chris.bash "\argv Test" I want to detect if the user supplied \argv at the start of the argument (3 Replies)
Discussion started by: kristinu
3 Replies

10. Shell Programming and Scripting

Bash : Checking Large file for specific lines

Morning .. I have a file with approximately 1000 lines. I want to check that the file contains, for example, 100 lines. Something like whats given below is ugly. And even if I create a function I have to call it 100 times. I may need to look through multiple files at times. Is there a... (4 Replies)
Discussion started by: sumguy
4 Replies
XvGetVideo(3)							  libXv Functions						     XvGetVideo(3)

NAME
XvGetVideo - capture video from a drawable SYNOPSIS
#include <X11/extensions/Xvlib.h> int XvGetVideo(Display *dpy, XvPortID port, Drawable d, GC gc, int vx, int vy, unsigned int vw, unsigned int vh, int dx, int dy, unsigned int dw, unsigned int dh); ARGUMENTS
dpy Specifies the connection to the X server. port Defines the port to which video output is sent. d Defines the drawable (window) from which video output is to be obtained. gc Defines the graphical context. GC components are: subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. vx,vy,vw,vh Define the location and size of the video region is to be written. vx and vy define the xand y coordinates of the upper- left corner of the video region; vwand vh define the width and height, in pixels, of the video region. dx,dy,dw,dh Define the location of the source drawable from which the video image is to be taken. dxand dy define the xand y coordi- nates of the upper-left corner of the drawable region; dwand dh define the width and height, in pixels, of the drawable region. DESCRIPTION
outputs video from a drawable. The position and size of the destination rectangle is specified by vx, vy, vw, and vh. The position and size of the source rectangle is specified by dx, dy, dw, and dh. Drawable data is clipped to the bounds of the drawable, scaled to the requested video region size (or the closest size supported) and clipped to the bounds of the video encoding. The contents of any region not updated with drawable data is undefined. If video is successfully initiated, an XvVideoNotify event with detail XvStarted is generated for the drawable. If the port is already in use, its video is preempted, and if the new drawable is different than the old, an XvVideoNotify event with detail XvPreempted is generated for the old drawable. If the port is grabbed by another client, this request is ignored, and an XvVideoNotify event with detail XvBusy is generated for the drawable. RETURN VALUES
[Success] Returned if XvGetVideo(3) completed successfully. [XvBadExtension] Returned if the Xv extension is unavailable. [XvBadAlloc] Returned if XvGetVideo(3) failed to allocate memory to process the request. DIAGNOSTICS
[XvBadPort] Generated if the requested port does not exist. [BadGC] Generated if the requested graphics context does not exist. [BadDrawable] Generated if the requested drawable does not exist. [BadAlloc] Generated if there were insufficient resources to process the request. SEE ALSO
XvGetStill(3), XvPutVideo(3), XvVideoNotify(3) X Version 11 libXv 1.0.7 XvGetVideo(3)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy