#!/bin/bash
hello()
{
SRC=$1
DEST=$2
for IP in `cat /opt/ankit/configs/machine.configs` ; do
echo $SRC | grep '*' > /dev/null
if test `echo $?` -eq 0 ; then
for STAR in $SRC ; do
echo -en "$IP"
echo -en "\n\t ARG1=$STAR ARG2=$2\n\n"
done
else
echo -en "$IP"
echo -en "\n\t ARG1=$SRC ARG2=$DEST\n\n"
fi
done
}
hello $1 $2
The above script shell in which I provide the source path (SRC) and desitnation (DEST). It worked great when I didn't insert the SRC path with a wild card. '' When I run this shell script and give '.pdf or' * 'as follows:
root@ankit1:~/as_prac
I get the following output:
192.168.1.6
ARG1=/home/dev/Examples/case_Contact.pdf ARG2=/home/dev/Examples/case_howard_county_library.pdf
DEST is / ankit_test /, but DEST also gets manupulated due to '*'. Expected response
ARG1=/home/dev/Examples/case_Contact.pdf ARG2=/ankit_test/as
So, if you understand what I'm trying to do, please help me solve this problem. I would be grateful to you.
Thanks in advance!
I need to know exactly how I use "* .pdf" in my program one by one, without breaking DEST.
source
share