10-01-2002
Quote:
Originally posted by Bab00shka
string2=`echo $string | cut -c1-c$length`
You want "cut -c1-$length". Lose that "c" directly in front of the variable.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ?
I've given portion of the script here to explain the problem.
Portion of Script 1
=============
-----
-----
tmp=`a.ksh p1 p2 p3`
if then
# error processing
fi
-----... (10 Replies)
Discussion started by: rajarkumar
10 Replies
2. Shell Programming and Scripting
Ok, I sort of need to create a command files that will be ftped to another server to run.
I have some input variable that will need to be read, and then transformed into another script file. Here are some examples.
Server 1:
outputCmd.sh
passing in ./outputCmd.sh nh8oaxt Release_4_0... (1 Reply)
Discussion started by: orozcom
1 Replies
3. Shell Programming and Scripting
I have 2 scripts.The first script greps something and prints it
say a.sh
#!/bin/sh
ccc="grep something and cut something"
echo $ccc
When you run this it gives a value say "100"
I have b.sh and I have
#!/bin/sh
status=`/home/a.sh`
status_code=$?
echo status_code
When I run... (7 Replies)
Discussion started by: gubbu
7 Replies
4. Shell Programming and Scripting
Hi,
I want to take input from one script like :
1. Enter ip address :
2. Enter port :
Now, I want to -
a. Store these in variables,
b. Call a separate script (say, x) from this script (say, y)
c. And use the stored variables in the called script (i.e. in script 'x').
How do I... (5 Replies)
Discussion started by: angshuman_ag
5 Replies
5. Shell Programming and Scripting
Hi,
I have a script get_DB_var.ksh which do a data base call and get some variables as below:
sqlplus -silent $user/$pass@dbname <<END
select col1,
col2,
col3
from table_name where col4=$1;
exit;
END
Now I want to access all these variables i.e.... (9 Replies)
Discussion started by: dips_ag
9 Replies
6. Shell Programming and Scripting
Hi All,
Just give me an idea on how to do the below logic.
1. I have one master script masterload.sh, the usage of this script is
a. masterload.sh FULL BFLF_LOAD.txt
b. masterload.sh DELTA TDLD_LOAD.txt
c.masterload.sh USER MAS_LOAD.txt
FULL , DELTA ,USER are the varaibles based... (1 Reply)
Discussion started by: mora
1 Replies
7. Shell Programming and Scripting
Hi.
Is there any way of in a script ask the user something and with the user answer retreave a internal result that uses the variable that the user had introduced?
Thanks (3 Replies)
Discussion started by: whity
3 Replies
8. Shell Programming and Scripting
Hi All,
i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??
#!/bin/ksh
##script is sample.ksh
age=$1
gender=$2
class=$3
.
.
.... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies
9. UNIX for Dummies Questions & Answers
Hi Chaps,
Im after some advise with a script i've written however doesnt appear to work how I would like.
Basically I have a perl script which sucessfully pulls an expect script to login to multiple nodes and obtain some output from the nodes (total number of nat ports that are in use... (0 Replies)
Discussion started by: mutley2202
0 Replies
10. Shell Programming and Scripting
Hi All,
I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them
abc.sh
----------
export Numbr_Parms=$#
export a=1
while
do
export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
bcopy(3) Library Functions Manual bcopy(3)
NAME
bcopy, bcmp, bzero - Perform memory operations
LIBRARY
Standard C Library (libc)
SYNOPSIS
#include <strings.h>
void bcopy(
const void *source,
void *destination,
size_t length);
int bcmp(
const void *string1,
const void *string2,
size_t length);
void bzero(
void *string,
size_t length);
The following function definitions do not conform to current standards and are supported only for backward compatibility:
#include <string.h>
void bcopy(
const char *source,
char *destination,
int length);
int bcmp(
const char *string1,
const char *string2,
int length);
void bzero(
char *string,
int length);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
bcopy(), bcmp(), bzero(): XSH5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the original string for the bcopy() function. Points to the destination string for the bcopy() function. Specifies the byte
string to be compared to the string2 parameter by the bcmp() function. Specifies the byte string to be compared to the string1 parameter
by the bcmp() function. Specifies the length (in bytes) of the string.
DESCRIPTION
The bcopy(), bcmp(), and bzero() functions operate on variable length strings of bytes. Unlike the string functions, they do not check for
null bytes.
The bcopy() function copies the value of the length parameter in bytes from the string in the source parameter to the string in the desti-
nation parameter.
The bcmp() function compares the byte string in the string1 parameter against the byte string of the string2 parameter, returning a 0
(zero) value if the two strings are identical and a nonzero value otherwise.
The bzero() function nulls the string in the string parameter, for the value of the length parameter in bytes.
NOTES
[Tru64 UNIX] The bcopy() function is similar to the memcpy() function except that the first two parameters are reversed.
RELATED INFORMATION
Functions: memccpy(3), memcpy(3), string(3), swab(3)
Standards: standards(5) delim off
bcopy(3)