Page 1 of 1

Issue writing a function... !

Posted: Mon 10 Feb 2014, 16:19
by vnairaj
Hello all..
I have return a script which is needed to return a value if it is successfully completed.

my code is :


#!/bin/bash

echo "enter the source path for file1 with file extension"
read source1

echo "enter file1 name with extension"
read file1


echo "enter the source path for file2 with file extension"
read source2

echo "enter file2 name with extension"
read file2

echo "Target location : "
read target

echo $file1 "started copying...."

cp $source1 $target

echo "$file1 is copied to target location successfully \n"

echo "$file2 started copying...."
cp $source2 $target

cd $target
echo "$file1 started uncompressing.."
gunzip $file1

echo "$file1 uncompressed successfully"

echo "$file2 started uncompressing.."
gunzip $file2

echo "Files unzipped"


It need to return a value 0 ..
If everything is executed properly.. All the things are executing properly but am nt able to put it in a function..


can you please put it into a function ..
please help... !

Posted: Mon 10 Feb 2014, 18:52
by Flash
Please don't post the same question several places in the forum. Thanks. :) (I moved them both to the Programming section.)