Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Dummie: How do I get variables mid program Post 20805 by RichardB on Sunday 5th of May 2002 10:57:23 AM
Old 05-05-2002
Dummie: How do I get variables mid program

I'm writing a simple program in unix and was wondering how mid switch I can run a program and get someone to enter variables for it i.e.:
#!/bin/csh -f
echo "If you wish to do v press v"
echo "If you wish to compile press c"
echo "If you wish to add an entry press a"
echo "If you wish to compile by name rather than formula press n"
echo "If the table needs sorting by formula press f"
echo "If you have finished all operations press x"
set valid = false

while ( $valid == false )

switch ( $< )

case v:
echo "view all"
more A.txt
MAIN
breaksw

case c:
(THIS IS THE BIT IM STUCK ON!!!!!!!!)
echo "enter the required?"
switch ( $< ) (THIS DOESN@T WORK SO HOW CAN I DO IT- when at the prompt search $1 etc works)
search $1 $2 $3 $4 $5 $6 $7 $8 $9
MAIN
breaksw

case a:
echo "ensure"
addone
MAIN
breaksw

case n:
echo "all entries sorted by name"
sort A.txt $10 | more
MAIN
breaksw
case f:
sortform
MAIN
breaksw

case x:
set valid = true
breaksw

default:
echo "Invalid response, try again"
breaksw

endsw
end

Any help would be greatly appreciated.

Rich
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Please help this Dummie

I am trying to integrate a Digital Unix Alpha server in a LAN that contains several NT severs. Could someone give me some advise on how to integrate Alpha server, so I can contact the Alpha from any NT and visa versa. Thanks! (1 Reply)
Discussion started by: Rmeyvogel
1 Replies

2. UNIX for Advanced & Expert Users

Dump program variables

Hi, Wish if could provide some clues. How do I dump all the C program variables(global) into say a file with their names and the values. So that when I restart the application again I could use this same file for reinitializing.Is this possible? Thanks, Reji (1 Reply)
Discussion started by: rejise
1 Replies

3. Shell Programming and Scripting

Passing shell variables to awk program..

Hello, Can we pass shell variables like $PATH etc. to a awk program part for example, awk ' { fieldValue=$PATH .... }' file (1 Reply)
Discussion started by: Vishnu
1 Replies

4. Shell Programming and Scripting

How to access the C program variables in shell script

hi I wanted to access the C program variables in shell script. This script is called from the same C program. What are the ways in which i can access variables thankx (3 Replies)
Discussion started by: bhakti
3 Replies

5. Shell Programming and Scripting

dummie ksh

Please help me with a newbie ksh question: I want a script in ksh (under Solaris 8 - SPARC) who runs a "ls -lR" command in some directory and it looks after all the files with the same date as the current one and/or created in the last 24 hours (or N hours). The script should do: - if no... (3 Replies)
Discussion started by: heartwork
3 Replies

6. UNIX for Dummies Questions & Answers

Small Program with variables

Hello Geniuses of the unix world. please help, stupid chemist. I have the following script that I need to create a file. Doesnt make sense unless i explain this way: I need to create a file called summary.in I would like all these lines to be inserted however in the command line I would like the... (1 Reply)
Discussion started by: gingburg
1 Replies

7. UNIX for Dummies Questions & Answers

I'm a dummie!

Hi I was installing 10.04. At 38 minutes remaining it froze and stayed that way for about 2 hours. I shut it down and now It's "frozen" for lack of a better term. ubuntu screen comes up, goes to black screen with blinking cursor. Anyone? Thanks! ---------- Post updated at 08:03 PM ----------... (1 Reply)
Discussion started by: martinnod
1 Replies

8. UNIX for Dummies Questions & Answers

I am not able to use variables in system command in a C program

this method is not working.I am having a problem to use variables in system command. i cannot use the variables in system command. this how i was did system("whereis command"); this method works very fine. but, i want use the commands as variable. that means i want only pass the variables.... (6 Replies)
Discussion started by: dhanda2601
6 Replies

9. UNIX Desktop Questions & Answers

Knowing the size and location of variables in a C program

So I need some help with this. Pardon me if I'm posting in the wrong forum, after some googling for my answer and finding nothing I found this forum. It seemed appropriate for what I was seeking. I just didnt find a forum that concerned the use of GDB. I'm learning to use the C language and GDB.... (2 Replies)
Discussion started by: Cambria
2 Replies

10. Shell Programming and Scripting

Using env variables to run a program

Hi there, I need urgent help with a small program that is run via shell script. Unfortunately I only understand the bare basics of shell scripting and can't figure out how to do this. We have a program that tests the connection between 3 servers. I have a script that lets the program run on... (15 Replies)
Discussion started by: Pherdinand
15 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.11 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 02:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy