LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-09-2008, 03:21 AM   #1
seuchato
LQ Newbie
 
Registered: Jul 2006
Posts: 14

Rep: Reputation: 0
bash input redriction problem


Hi there

Quote:
echo -e "$inp" >inf2
CA.pl -newca <inf2
echo -e -n "$inp" | CA.pl -newca
"CA.pl -newca <inf2" works as desired, while "echo -e -n "$inp" | CA.pl -newca" does not. I do not understand why, any clues?

Greets chris
 
Old 01-09-2008, 05:04 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
does the -e -n inhibit newlines?

if so the perl read is waiting for a newline char probably.
 
Old 01-09-2008, 06:34 AM   #3
seuchato
LQ Newbie
 
Registered: Jul 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Hi bigearsbilly
Quote:
Originally Posted by bigearsbilly View Post
does the -e -n inhibit newlines?

if so the perl read is waiting for a newline char probably.
the -n does in fact not add a newline after the echo command, but I composed the $inp string with the required "\n" chars (that's what the -e is required for, at least acc. man echo). The proof is, that is actually runs "CA.pl -newca <inf2". Remember, inf is generated from same "echo -e "$inp" >inf2" $inp string. finally, I get the same behaviour when running "echo -e "$inp" | CA.pl -newca"
actually here is the way i generate inp:
Quote:
inp="\n$cc\n$sp\n$loc\n$on\n$un\n$cn\n$email\n\n\n"
you can see the new lines (\n) and the parameters like $cc (country code) ...
again, if $inp is echoed ot a file, and this is redirected to CA.pl it runs perfectly. The passphrases have to be keyed in physically (desired imho), the rest is read from $inp respectively inf2

besides: i run Suse 10.3, 64 bit, last updated 3 hours ago, xen-pae, AMD X2 64, 4G ram, Raid5 LVM.


any other idea?
 
  


Reply

Tags
bash, input, piping, redirection



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 06:40 PM
bash input/output redirect problem greno Programming 2 12-31-2006 03:23 PM
bash - how to take input as a variable? trees Linux - General 1 02-19-2004 04:09 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM
Text input in bash? pk21 Programming 12 06-05-2003 09:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration