Sponsored Content
Full Discussion: newb shell question
Top Forums Shell Programming and Scripting newb shell question Post 11854 by Fokus on Thursday 13th of December 2001 02:34:14 AM
Old 12-13-2001
CPU & Memory newb shell question

I know this is a total begginer question but what is wrong with this picture. My loop wont loop, it just drops me back to the prompt and gives the error "unary operator expected". Any help would be appreciated.

here it is,

#!/bin/sh
selection=
while [ $selection -ne9 ]
do
cat << MENU
1)List files in current directory
2)Display pwd
3)Remove a directory
4)Create a directory
5)Copy a file
6)Remove a file
7)Change directory
8)Mail file to user
9)EXIT
MENU
echo "Enter selection:\c"
read selection
echo "the user selected option $selection"
if [ $selection -eq 1 ]
then
ls
elif [ $selection -eq 2 ]
then
pwd
elif [ $selection -eq 3 ]
then
echo "Name of dir to delete"
read option3
rm -r $option3
elif [ $selection -eq 4 ]
then
echo "Name of dir to create"
read option4
mkdir $option4
elif [ $selection -eq 5 ]
then
echo "Name of file to copy"
read option5
echo "Where to move it to?"
read option55
cp -r $option5 $option55
elif [ $selection -eq 6 ]
then
echo "Name of file to delete"
read option6
rm -r $option6
elif [ $selection -eq 7 ]
then
echo "Name of directory to change to"
read option7
cd $option7
pwd
elif [ $selection -eq 8 ]
then
echo "Name of file to send"
read option8
echo "Who to send it to"
read option88
mailx $option8 < $option88
elif [ $selection -eq 9 ]
then
exit
else
echo "Please enter a valid selection"
fi
done
 

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
xcb_set_selection_owner(3)					   XCB Requests 					xcb_set_selection_owner(3)

NAME
xcb_set_selection_owner - Sets the owner of a selection SYNOPSIS
#include <xcb/xproto.h> Request function xcb_void_cookie_t xcb_set_selection_owner(xcb_connection_t *conn, xcb_window_t owner, xcb_atom_t selection, xcb_timestamp_t time); REQUEST ARGUMENTS
conn The XCB connection to X11. owner The new owner of the selection. The special value XCB_NONE means that the selection will have no owner. selection The selection. time Timestamp to avoid race conditions when running X over the network. The selection will not be changed if time is earlier than the current last-change time of the selection or is later than the cur- rent X server time. Otherwise, the last-change time is set to the specified time. The special value XCB_CURRENT_TIME will be replaced with the current server time. DESCRIPTION
Makes window the owner of the selection selection and updates the last-change time of the specified selection. TODO: briefly explain what a selection is. RETURN VALUE
Returns an xcb_void_cookie_t. Errors (if any) have to be handled in the event loop. If you want to handle errors directly with xcb_request_check instead, use xcb_set_selection_owner_checked. See xcb-requests(3) for details. ERRORS
xcb_atom_error_t selection does not refer to a valid atom. SEE ALSO
xcb-requests(3), xcb_set_selection_owner(3) AUTHOR
Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. XCB
2014-06-10 xcb_set_selection_owner(3)
All times are GMT -4. The time now is 10:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy