Sponsored Content
Full Discussion: newb shell question
Top Forums Shell Programming and Scripting newb shell question Post 11857 by LivinFree on Thursday 13th of December 2001 03:56:43 AM
Old 12-13-2001
The first think I'm seeing is the while statement at the top...

selection=
while [ $selection -ne9 ]

First one:
I always use quotes - to be safe.
And check your spacing...
while [ "$selection" -ne "9" ]

Also though, you just defined $selection as being nothing... it would look like this when expanded:

while [ -ne 9 ]

Try:
selection=0
while [ "$selection" -ne "9" ]

Also, it'll make it cleaner to use a "case" statement, instead of a bunch of "if"s...

case $selection in
1) do_something ;;
2) do_something_else ;;
*) default_at_end ;;
esac

Hope that gets you back on the right track...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help for a newb

ok i just installed FreeBSD 4.8 on a computer i had lying around and it was working ok but then when i tried to set up KDE's xdm (kdm) i think i must have configured the login manager wrong because i cant login through the kdm and therefore i can log in to BSD at all?! please can someone help me... (5 Replies)
Discussion started by: h3x
5 Replies

2. UNIX for Dummies Questions & Answers

Newb question

I don't even know if this should go here but I just would like to know what this means: d0e45878043844ffc41aac437e86b602 I know absolutely nothin' about UNIX, and I found this in a SQL table in a board I run. Someone please tell me what that is in "normal" mode. Pardon me for my... (4 Replies)
Discussion started by: daeglin
4 Replies

3. UNIX for Dummies Questions & Answers

Ok I'm a Newb, Please Help

I am wanting to download the Linux Program. When i go to download it I see several things to download. What do i download exactly? Then what do I do to install it. Also I have partitioned my hard drive to make way for Linux on the other part to play with it, will any problems arise from this? I... (3 Replies)
Discussion started by: Seeto
3 Replies

4. Shell Programming and Scripting

Newb scripting question, I get the error script not found

This is probably a really simple problem, but goes easy on me I'm still a newb. The problem I have is that a script (we'll call it script.script) I edited won't run for some reason, I get the error "ksh: script.script: not found" The location of my script is as follows: /home/users/arkitech ... (3 Replies)
Discussion started by: Arkitech
3 Replies

5. Shell Programming and Scripting

Another newb question: how to use test for zero-length string ?

Assume $x equals "". If I try: if test -n $x I get the "Expression syntax" error. It works in Linux but not in unix bash. In unix bourne I get "test: argument expected" (4 Replies)
Discussion started by: lumix
4 Replies

6. Shell Programming and Scripting

Newb with While loop question

My first post here.... I have a few years exp with linux distros and some very basic Python..Ive been intent on learning shell scripting the last few weeks. Please excuse my crude efforts. I am running a program that takes network data containing US city names in plain text. I am TRYING to... (7 Replies)
Discussion started by: dddkkk
7 Replies

7. HP-UX

Newb Help, need to image one HD to another

Hello, I am totally new to Unix We have a piece of test equipment, three of them actually, that run HP-UX 9.0 from like 1994. We had backup tapes with procedures to load the OS and our test software, but the 16-track tapes are corrupt now. HP will not support it, they dont have it anymore,... (11 Replies)
Discussion started by: Newball80
11 Replies

8. UNIX for Dummies Questions & Answers

Newb writing his first shell script

Hey! This is my first post on this forum, nice to meet ya! I've been using Linux for a good few years, I grew up using DOS and a few similar CLI-based OS's so I'm fairly okay with navigating my way around the terminal. Recently I decided I wanted to become a sysadmin so I've been teaching... (3 Replies)
Discussion started by: Tamachan87
3 Replies

9. Shell Programming and Scripting

Newb question about getting a word from a text file

Hi everyone. I am new to shell scripting and have been looking at quite a few web pages to try and figure this out, but to no avail. What I am trying to do is get a value from a text file that contains a paragraph of information.. Something similar too: Welcome to random script You are... (1 Reply)
Discussion started by: elemenopee
1 Replies

10. UNIX for Dummies Questions & Answers

NEWB Question - BASH COMMAND RESULT for ${0##*/}

This should be extremely simple and someone will probably answer it in .5 seconds. I need to know what: VARIABLE=${0##*/} does? I do not have a shell handy to just try it in. I am reading through some scripts and need to understand this line. Any help is appreciated. Many thanks! -... (3 Replies)
Discussion started by: chrisgoetz
3 Replies
XtDisownSelection()													       XtDisownSelection()

Name
  XtDisownSelection - indicate that selection data is no longer available.

Synopsis
  void XtDisownSelection(w, selection, time)
	 Widget w;
	 Atom selection;
	 Time time;

Inputs
  w	    Specifies the widget relinquishing selection ownership.

  selection Specifies which selection the widget is giving up (usually XA_PRIMARY or XA_SECONDARY).

  time	    Specifies the timestamp that indicates when the request to relinquish selection ownership was initiated.

Description
  XtDisownSelection() informs the Intrinsics selection mechanism that the specified widget is to lose ownership of the specified selection as
  of the specified time.  If the widget does not currently own the selection, either because it lost the selection or because  it  never  had
  the selection to begin with, XtDisownSelection() does nothing.

  After  a widget has called XtDisownSelection(), its XtConvertProc is not called even if a request arrives later with a timestamp during the
  period that this widget owned the selection.	However, its XtDoneProc will be called if a conversion that started before the call to XtDis-
  ownSelection() finishes after the call to XtDisownSelection().  See XtOwnSelection() for more information.

Usage
  Usually, a selection owner maintains ownership indefinitely until some other client requests ownership, at which time the Intrinsics selec-
  tion mechanism informs the previous owner that it has lost ownership of the selection.  However, in response	to  some  user	actions  (for
  example,  when  a user deletes the information selected), the application may with to explicitly inform the Intrinsics that it no longer is
  to be the selection owner by calling XtDisownSelection().

  When the selection changes hands because another client has claimed it (rather than as a result of  a  call  to  XtDisownSelection()),  the
  Intrinsics inform the application that it has lost the selection ownership by calling its XtLoseSelectionProc.

See Also
  XtGetSelectionValue(1), XtOwnSelection(1),
  XtConvertProc(2), XtDoneProc(2), XtLoseSelectionProc(2).

Xt - Selections 													       XtDisownSelection()
All times are GMT -4. The time now is 03:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy