Issue writing a function... !

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Locked
Message
Author
vnairaj
Posts: 2
Joined: Mon 10 Feb 2014, 14:29

Issue writing a function... !

#1 Post 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... !

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Please don't post the same question several places in the forum. Thanks. :) (I moved them both to the Programming section.)

Locked