code for file transfer in linux

January 27, 2010 at 04:31:25
Specs: Windows XP
i am new for linux os, so how can i write a code to accept files fillename1 and filename2 as shell argument

See More: code for file transfer in linux

Report •

#1
January 27, 2010 at 05:01:41
$1, $2 ...

filename1=$1 ;
filename2=$2 ;
cat $filename1 ;
read ;
cat $filename2 ;

(for example)
type:
man bash
or:
man sh
to get the gist of shell syntax and expression


Report •

#2
January 27, 2010 at 05:45:22
i am new for linux os
Most important command:
man


Report •

#3
January 27, 2010 at 06:20:48
Yes, but MAN is for commands specific ... general stuf like how to pass parameters, may be somewhat harder to find there, since it is considered basic programming.

Chery, if I get the question, you would need this:

---------------

if [ "$2" = "" ]
then
echo Usage is : `basename $0` filename1 filename2
exit 1
fi

filename1=$1
filename2=$2


And then just use $filename1 and $filename2


Report •

Related Solutions

#4
January 27, 2010 at 06:54:26
general stuf like how to pass parameters
man sh
Or in the case of HP-UX:
man sh-posix


Report •

#5
January 27, 2010 at 07:17:21
Well, you first need to know you are running SH, and if you do not know how parameters get used, this may already be one bridge too far. I guess "man parameter" does not work, does it ? Or "man $1" ... you know, help pages only help if you know what you look for. Sounds silly, but there is logic in there.

That was ... euhm, what I was saying. ;)


Report •

#6
January 27, 2010 at 07:37:45
Well, you first need to know you are running SH
There's a reason the abbreviation RTFM exists. (Presumably, that's where you'll find out about man as well.)

Report •

#7
January 28, 2010 at 02:56:20
You're right ... I guess Chery is reading through the 200 pages "man sh" right now

Chery ?


Report •

#8
January 28, 2010 at 04:23:05
Why we use code file inlinux ... ??? reply me sooon meet again...
Web Design Company Chennai | Seo Services Chennai

Report •

Ask Question