I am new to scripting and require some assistance please.
I am trying to define a variable with a wildcard in a shell script (.ksh) that will be run on AIX 5300-10.
The variable I am trying is:
When I run the following section of the script:
I am receiving the following error:
I can see the file in the directory, and it has the correct permissions set so there should be no issue discovering or moving it. The wildcard is obviously not being expanded which is causing the problem.
This script will move files from a windows server running the RSIT application to a UNIX box. Could you please advise if it is possible to use a wildcard in a variable, and if it is, how I would go about it?
You have to force an evaluation on it. There can be several ways... the portable way in bourne shells is with the "eval" command.
However, expansion can fill up the command line buffer limit.... so it might be better to look at how to use "find" and "xargs" if at all possible. That way you can also avoid the use of "eval" which could introduce other side effects. With that said, unless you're using SSH keys above, you'd have to type in your password for every scp call (xargs will make as many calls as needed to get handle a large list of incoming arguments).
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
I have a small program which needs to pass variable dynamically to form the name of a second variable whose value wil be passed on to a third variable.
***************** Program Start ******************
LOC1=/loc1
PAT1IN=/loc2
PAT2IN=/loc3
if ; then
for fpattern in `cat... (5 Replies)
Hi Folks,
I would like to pass a variable with a wild card in an argument. My script works if I don't use a wildcard but fails when I use *. I want to use the script like:
scriptname -F <filename*>
@ i = 0
while ($i <= ${#argv})
switch ($argv)
case -F:
set j = `echo $i +1... (2 Replies)
I have a script to fix permissions which is made up of blocks like:
FS_ROOT=/home/shared/Photos
FS_EXCLUDE=( \( -path */.webviews -o -path */.thumbnails \) -prune -o )
find $FS_ROOT ${FS_EXCLUDE} -type d -not -perm 2770 -exec chmod 2770 "{}" \;
That fragment works as expected, but no matter... (3 Replies)
I am new to shell programming, i have a requierement to assign a file name into a variable.
for ex:
the file name are below
603_2009_09_24_34.csv
702_2009_10_25_10.csv
for ex: i need to get the file 603_2009_09_24_34.csv but first 3 didgits are fixed but rest of the digits are not
below is... (3 Replies)
Hi all,
I have this scenario where:-
The file that I want to save its name into array df is my.08120323.trx which is located in the dir as below:
$ pwd
/u01/abc/def/SRC_datafiles
$ ls *trx
my.08120323.trx
$ df=*"trx" ##keeping the filename my.08120323.trx into df
$... (2 Replies)
Any help would be great. I know this is a dumb way of doing this, but I would like to know if there is a solution doing it this way. I'm very new at this and I'd like to learn more. Thanks! :D:D
count=0
while ; do
echo "enter your name"
read name_$count
let count=count+1
done
... (2 Replies)
I would like to know how to pass a variable inside a variable to a function.
sample code below
--------------
for x in 1 9
do
check_null $C$x ##call function to check if the value is null
if
then
echo "line number:$var_cnt,... (2 Replies)
Hi,
If a script A(Parent) is running and script B(child) is run from script A, will the variables in script A be past to script B?
Will the variables exist only for the duration of running the script?
Thank you (2 Replies)
I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days...
The structure of the paths are like this:
/home/domains/www.domain2.com/tgp/
/home/domains/www.domain3.com/tgp/... (1 Reply)