The problem is:
num is an int, but argv[1] is a char* as declared in the main function. Those are not compatible data types. 804400053 is the address of argv[1] and is just a memory address inside the computer. You cannot assign argv[1] to num and expect to get a meaningful result.
Try using atoi or sscanf to convert argv[1] to num.
The file dbnames.txt has 5 columns, what i'm trying to do is that when the fifth column equals A, store in the variable "access" the word, "admin access". If it equals B, then "business access" etc. I think their is a problem with my sed command, because it is not substibstituting the words... (1 Reply)
Hi,
I'm trying to write a routine to parse a file that contains data that will be read
into arrays. The file is composed of labels to identify data types and arbitrary
lines of data with the usual remarks and empty new lines as is common with
config files.
The initial pass is built as so:... (3 Replies)
i have a bash script on serverA, when i run the script on the server, it runs fine. the way to run the script is like this ./script "option1"
Now i am trying to call it from local laptop using ssh command, my command is as the following
ssh serverA ~/script "option1"
and i got error... (7 Replies)
I started writing a script to save the files from a camera I got the other day, which mounts in /Volumes , and I got into it and started building this menu. The only problem is that the switch case is coming up as a syntax error at the parenthesis after a case. Here is the code:
while :
do
... (2 Replies)
I have a csh script plot-model.csh
I want to be able to pass wildcards for the input file names such as
./plot-model.csh *8x6smp.cmod
Currently I have to pass the full files names one after each other which I then store in a list. Then I proceed to plot the data within it.
Now I... (7 Replies)
Hi... can anyone please help me out in using the CASE and command line argument in shell script... i am bit new to shell scripting...below i have explained my proble with example...
say i have an executable file with name 'new1.sh' and there are 3 functions in it a(), b() and c()....and there... (5 Replies)
I'm pretty new to bash scripting and I've found myself writing things like this (and the same with even more nesting):
if $CATEGORIES; then
if $LABEL_SLOTS; then
$pyth "$wd/texify_grammar.py" "$input" "$texfile" "--label-slots" "--categories" "$CATEGORY_LIST"
... (9 Replies)
Hello friends,
I have a boubt passing different arguments at a time for any one option in below code.
I would also like to check which option has been selected (any one of i, r, u ) so that whether or not matching argument passed can be verified.
for i and r - install and re-install -... (4 Replies)
Hi
Im trying to run zip shell command from an Oracle job, but this has limitations.
This should take a few of explanaition,..
Oracle allows me to execute a command and then I can set up a fixed number of arguments. Ex: (summarizing in something like..):
JOB DEFINITION
job_name: test... (4 Replies)
Hello All,
I am writing a script that is to be placed on multiple servers, and of course I've started
running into some compatibility issues for certain shell commands.
The code below worked just fine on most of my machines except for a couple.
Here I had 4 separate lines in my script that... (3 Replies)
Discussion started by: mrm5102
3 Replies
LEARN ABOUT REDHAT
case
case(n) Tcl Built-In Commands case(n)
__________________________________________________________________________________________________________________________________________________NAME
case - Evaluate one of several scripts, depending on a given value
SYNOPSIS
case string ?in? patList body ?patList body ...?
case string ?in? {patList body ?patList body ...?}
_________________________________________________________________DESCRIPTION
Note: the case command is obsolete and is supported only for backward compatibility. At some point in the future it may be removed
entirely. You should use the switch command instead.
The case command matches string against each of the patList arguments in order. Each patList argument is a list of one or more patterns.
If any of these patterns matches string then case evaluates the following body argument by passing it recursively to the Tcl interpreter
and returns the result of that evaluation. Each patList argument consists of a single pattern or list of patterns. Each pattern may con-
tain any of the wild-cards described under string match. If a patList argument is default, the corresponding body will be evaluated if no
patList matches string. If no patList argument matches string and no default is given, then the case command returns an empty string.
Two syntaxes are provided for the patList and body arguments. The first uses a separate argument for each of the patterns and commands;
this form is convenient if substitutions are desired on some of the patterns or commands. The second form places all of the patterns and
commands together into a single argument; the argument must have proper list structure, with the elements of the list being the patterns
and commands. The second form makes it easy to construct multi-line case commands, since the braces around the whole list make it unneces-
sary to include a backslash at the end of each line. Since the patList arguments are in braces in the second form, no command or variable
substitutions are performed on them; this makes the behavior of the second form different than the first form in some cases.
SEE ALSO
switch(n)
KEYWORDS
case, match, regular expression
Tcl 7.0 case(n)