Operating System - HP-UX
1837960 Members
2334 Online
110124 Solutions
New Discussion

Passing arguements and printing it

 
vijaya
New Member

Passing arguements and printing it

conn=$1
echo $1 #This will display what i entered
how do i print it ?

if i say
ls -lt *.fmb |'{print $9,conn}
gives an error
3 REPLIES 3
Victor Fridyev
Honored Contributor

Re: Passing arguements and printing it

Hi,

I hope, you mean:
..
..
conn=$1
ls -lt *.fmb| awk '{print $9,cnn}' cnn=$conn
Entities are not to be multiplied beyond necessity - RTFM
A. Clay Stephenson
Acclaimed Contributor

Re: Passing arguements and printing it

You question is very unclear; it looks like you are trying to mix in some awk syntax without invoking awk. If all you want to do is send output to a printer, that is most often done via the "lp" command which can take a file or stdin as input.

echo "${conn}" | lp -dmyprinter

Man lp for details.
If it ain't broke, I can fix that.
vijaya
New Member

Re: Passing arguements and printing it

Thks for the reply.I have solved this.
just to clear what i wanted.

I would be passing a parameter(connect sting) to the shell script while running the shell script.The objective of shell script is just getting the output of ls -lt *.fmb i.e the listing of this file into the text as 1st paramter and second parameter as this connectstring.What i wanted was to write this parametr which i am passing along with the out of ls-lt to be writting to the same text file using print command .
Then the output of this shell script + the parameter would be rediredted to text file say tt.txt.
Then using the awk prog.awk tt.txt file i would be reading and again the output of this will be redirected to a file and this file will compile my form(fmb) using the 1st parameter fmb filename and second parameter(which the user enter i.e username&password to conn to the db at the begin).
thks for the support once again.
Vijaya