02-16-2011
What are 'Dagger' and 'Fist Weapon' anyway - variables, constants, strings? I noticed, but ignored, the fact that 'Fist weapon' had a space in it. If it is a variable then how did you get this far? If it is a string literal, ie you are looking for the word "dagger" in $item['type'] then you need to quote these strings. Knowing what you are doing here will help.
Andrew
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
When ever i run this if statement with the -n OR -z switches it always returns says positive and does "HAVE STUFF". BUT the file does not contain the word optimus in any form.
$echo this is mojo > test.file
$if ; then
>echo HAVE STUFF
>else^Jecho NO STUFF
>fi
HAVE STUFF
$if ; then... (1 Reply)
Discussion started by: Optimus_P
1 Replies
2. Shell Programming and Scripting
Wow I'm so zoned out I don't even know if I posted this question up already (I couldn't find it in my book marks or in "yesterday's" post).
My question is, I'm writing a korn script that does something like the following, but I don't yet completely understand the syntax. I need to check that... (16 Replies)
Discussion started by: yongho
16 Replies
3. Shell Programming and Scripting
Hi All,
Can some one tell me how to get run the following:
data1="hello"
data2="world"
if
then
{
echo "good afternnon"
}
else
{
echo " good morning"
}
fi
The above code gives me an error ad below :
./if.h: line 3: ' (7 Replies)
Discussion started by: jisha
7 Replies
4. UNIX for Dummies Questions & Answers
Hi friends,
I have a script that sets the env variable path based on different conditions.
Now the new path variable setting should not done in the same terminal or same shell.
Only a new terminal or new shell should have the new path env variable set.
I am able to do this only as follows:
>cd... (1 Reply)
Discussion started by: sowmya005
1 Replies
5. Shell Programming and Scripting
Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP.
I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies
6. Shell Programming and Scripting
Hello Everybody,
thanks in advance for spending some time in my problem.
My problem is this:
I want to call a java-Programm out of my shell skript, check if die return code is right, and split the output to the normal output and into a file.
The following code doesn't work right, because in... (2 Replies)
Discussion started by: danifunny
2 Replies
7. Shell Programming and Scripting
Hi
What is the syntax for if statement using && and || operator?
if && ] ||
here its giving me an error to this if statement
any suggestion?? (2 Replies)
Discussion started by: Avi
2 Replies
8. Shell Programming and Scripting
Hi, I'm using the && operator in if statement:
if ; then
exp $UID/$PWD@$ORACLE_SID FILE=./DUMP/$TODAY$CONCAT_STR$USERNAME.dmp STATISTICS=NONE LOG=./LOG/$TODAY$CONCAT_STR$USERNAME.log
elif ; then
expdp $UID/$PWD@$ORACLE_SID DIRECTORY=./DUMP/ DUMPFILE=$TODAY$CONCAT_STR$USERNAME.dmp... (8 Replies)
Discussion started by: priya001
8 Replies
9. Shell Programming and Scripting
how do you write an if statement for something like
if ((expr 1 >= expr 2 && expr 3 >= expr 4) && expr 5 <= expr 6)
if ((TRUE && TRUE) && TRUE) then
condition...
i've done it this way but it doesn't seem to work.
if (] && "$ex_day" -le "$curr_day" ); then
condition... (3 Replies)
Discussion started by: angilulu
3 Replies
10. Shell Programming and Scripting
Hi All,
Do you have any sample script,
- auto get file from SFTP remote server and delete file in remove server after downloaded.
- only download specify filename
- auto upload file from local to SFTP remote server and delete local folder file after uploaded
- only upload specify filename
... (3 Replies)
Discussion started by: weesiong
3 Replies
XSTR(1) BSD General Commands Manual XSTR(1)
NAME
xstr -- extract strings from C programs to implement shared strings
SYNOPSIS
xstr [-cv] [-l array] [-] [file ...]
DESCRIPTION
xstr maintains a file strings into which strings in component parts of a large program are hashed. These strings are replaced with refer-
ences to this common area. This serves to implement shared constant strings, most useful if they are also read-only.
Available options:
- xstr reads from the standard input.
-c xstr will extract the strings from the C source file or the standard input (-), replacing string references by expressions of
the form (&xstr[number]) for some number. An appropriate declaration of xstr is prepended to the file. The resulting C text is
placed in the file x.c, to then be compiled. The strings from this file are placed in the strings data base if they are not
there already. Repeated strings and strings which are suffixes of existing strings do not cause changes to the data base.
-l array Specify the named array in program references to abstracted strings. The default array name is xstr.
-v Be verbose.
After all components of a large program have been compiled, a file xs.c declaring the common xstr space can be created by a command of the
form:
$ xstr
The file xs.c should then be compiled and loaded with the rest of the program. If possible, the array can be made read-only (shared) saving
space and swap overhead.
xstr can also be used on a single file. The following command creates files x.c and xs.c as before, without using or affecting any strings
file in the same directory:
$ xstr name
It may be useful to run xstr after the C preprocessor if any macro definitions yield strings or if there is conditional code which contains
strings which may not, in fact, be needed. An appropriate command sequence for running xstr after the C preprocessor is:
$ cc -E name.c | xstr -c -
$ cc -c x.c
$ mv x.o name.o
xstr does not touch the file strings unless new items are added, thus make(1) can avoid remaking xs.o unless truly necessary.
FILES
strings Data base of strings
x.c Massaged C source
xs.c C source for definition of array `xstr'
/tmp/xs* Temp file when `xstr name' doesn't touch strings
SEE ALSO
mkstr(1)
HISTORY
The xstr command appeared in 3.0BSD.
BUGS
If a string is a suffix of another string in the data base, but the shorter string is seen first by xstr both strings will be placed in the
data base, when just placing the longer one there will do.
xstr does not parse the file properly so it does not know not to process:
char var[] = "const";
into:
char var[] = (&xstr[N]);
These must be changed manually into an appropriate initialization for the string, or use the following ugly hack.
Also, xstr cannot initialize structures and unions that contain strings. Those can be fixed by changing from:
struct foo {
int i;
char buf[10];
} = {
1, "foo"
};
to:
struct foo {
int i;
char buf[10];
} = {
1, { 'f', 'o', 'o', '