I figured out a way to assign the variables, cleaned up my code a bit also and it all works. Just one more question if possible, and my internet research into the select command has so far turned up nothing. Instead of having to pick the number from the menu list, is it possible to use the name of the variable instead?
So instead of:
1) Tom
2) Dick
3) Harry
4) Quit
What would you like to choose: 3
As well as, or instead of, 3, you could write "Harry" and it would work. Obviously, the case function would throw an error if it wasn't 3 or Harry, for example you wrote Harryyy.
One more thing. I have created 3 files, FileA File B and File C. I want to set it so only FileA can be opened if Tom was selected previously, File B if Dick was selected previously, nd FileC if Harry was selected previously, else error. I figured the code might be something like:
Cheers for all your help! I have never done programming before, but you have helped learn loads.
well i have this code here..and it works fine in kornshell..
#!/bin/ksh
home=c:/..../
input=$1
sed '1,3d' $input > $1.out
line=""
cat $1.out | while read a
do
line="$line $a"
done
echo $line > $1
rm $1.out
however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Greetings all,
I'm currently writing a shell script menu which is dynamically populated from an array. Have a question to ask about the filtering of invalid input. I'm using KSH.
A brief description of my algorithm is as follows:
1) Read in input from user and store in a variable. (a valid... (2 Replies)
I am trying to find a way to allow users to select multiple options in a shell menu. I am using case and it gives menu options 1-9, how can I set this up so that it give the user the ability to choose more then one option, ie 1,2 or 3,4,5, etc... (4 Replies)
Dear All,
Kindly suggest on how should i proceed with the following requirement
I need to develop an interactive shell script menu which would enable the user to inquire the value of a column based on a key value . The output can be more records..
Also is it possible to do the following
1)... (2 Replies)
Hi, I am getting the error
01.30 Invalid shell error
I am running the bash shell script in the korn login shell.
I have mentioned the #!/bin/bash statement in the my script but not sure why it is giving this error to me.. (4 Replies)
Hi All
I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell.
Some operations like calculation don't work :
cat ${file1} | tail -$((${num1}-${num2})) > ${file2}
Is it possible to activate Korn Shell... (3 Replies)
Dear all,
I'd be so grateful if I could get great feedback again for my problems.
We usually spool some text files from our system in csv format.
Unfortunately, some data contains ',' (comma) and it's rare case but when it comes to spool, that row included comma should be invalid data, due... (2 Replies)
The script below fails with the following error messages:
gzip: invalid option -- 'w'
Try `gzip --help' for more information.
mysqldump: Got errno 32 on write
cp: invalid option -- 'w'
Try `cp --help' for more information.
rm: invalid option -- 'w'
Try `rm --help' for more information.
... (1 Reply)
Here is the question...
Create a new script, sub2, taking three parameters...
1.) the string to be replaced
2.) the string with which to replace it
3.) the name of the file in which to make the substitution
...that treats the string to be replaced as plain text instead of as a regular... (1 Reply)
Discussion started by: johnhisenburg
1 Replies
LEARN ABOUT HPUX
cat
cat(1) General Commands Manual cat(1)NAME
cat - concatenate, copy, and print files
SYNOPSIS
file ...
DESCRIPTION
reads each file in sequence and writes it on the standard output. Thus:
prints file on the default standard output device;
concatenates file1 and file2, and places the result in file3.
If is appears as a file argument, uses standard input. To combine standard input and other files, use a combination of and file arguments.
Options
recognizes the following options:
Omit line numbers from blank lines when
option is specified. If this option is specified, the option is automatically selected.
Print a
character at the end of each line (prior to the new-line). If this option is specified, the option is automatically selected.
Display output lines preceded by line numbers, numbered
sequentially from 1.
Replace multiple consecutive empty lines with one empty
line, so that there is never more than one empty line between lines containing characters.
Silent option.
suppresses error messages about non-existent files, identical input and output, and write errors. Normally, input and output
files cannot have identical names unless the file is a special file.
Print each tab character as
and form feed character as If this option is specified, the option is automatically selected.
Do not buffer output (handle character-by-character).
Normally, output is buffered.
Cause non-printing characters
(with the exception of tabs, new-lines and form-feeds) to be printed visibly. Control characters are printed using the form
(Ctrl-X), and the DEL character (octal 0177) is printed as (see ascii(5)). Single-byte control characters whose most signifi-
cant bit is set, are printed using the form where x is the character specified by the seven low order bits. All other non-
printing characters are printed as where x is the character specified by the seven low order bits. This option is influenced
by the environment variable and its corresponding code set.
EXTERNAL INFLUENCES
Environment Variables
provides a default value for the internationalization variables that are unset or null. If is unset or null, the default value of "C" (see
lang(5)) is used. If any of the internationalization variables contains an invalid setting, will behave as if all internationalization
variables are set to "C". See environ(5).
If set to a non-empty string value, overrides the values of all the other internationalization variables.
determines the interpretation of text as single and/or multi-byte characters, the classification of characters as printable, and the char-
acters matched by character class expressions in regular expressions.
determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa-
tive messages written to standard output.
determines the location of message catalogues for the processing of
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
Exit values are:
0 Successful completion.
>0 Error condition occurred.
EXAMPLES
To create a zero-length file, use any of the following:
The following prints for all the occurrences of tab character in file1
To suppress error messages about files that do not exist, use:
If file2 does not exist, the above command concatenates file1 and file3 without reporting the error on file2. The result is the same if
option is not used, except that displays the error message.
To view non-printable characters in file2, use:
WARNINGS
Command formats such as
overwrites the data in file1 before the concatenation begins, thus destroying the file. Therefore, be careful when using shell special
characters.
SEE ALSO cp(1), more(1), pg(1), pr(1), rmnl(1), ssp(1).
STANDARDS CONFORMANCE cat(1)