LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-05-2013, 05:42 AM   #1
dev_linux
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Rep: Reputation: Disabled
cygwin process substitution issue


Hello , I am quite new to linux and currently I am using cygwin on my windows machine . Problem is I made a script to automate my analytics work and used process substitution in it and it worked fine when running on cgwin . But when running that same script on linux machine it is showing problems with process substitution .So m bit confused.Please help.

Last edited by dev_linux; 07-05-2013 at 05:46 AM.
 
Old 07-05-2013, 06:01 AM   #2
eklavya
Member
 
Registered: Mar 2013
Posts: 619

Rep: Reputation: 136Reputation: 136
You haven't mentioned the problem.

as far as I know
Process substitution feeds the output of a process (or processes) into the stdin of another process.

If you are not able to share the script, you should share the error or issue. Without it we can't do much.
 
Old 07-05-2013, 06:33 AM   #3
dev_linux
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Problem is when running script on linux machine it is showing problem with line- done < <(cat pattern.txt)
 
Old 07-05-2013, 06:40 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
I think you will need to show us the script and the error it generates.
 
Old 07-05-2013, 08:08 AM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
First thing, post that snippet of your script where you're getting error. Second, invoke your script with debug mode i.e. add set -xv just below #!/bin/bash and invoke the script again, so you can see that where it's going wrong.

Also you can go thru following articles to better understand the process substitution:
http://mywiki.wooledge.org/ProcessSubstitution
http://www.tldp.org/LDP/abs/html/process-sub.html
 
Old 07-08-2013, 01:01 AM   #6
dev_linux
LQ Newbie
 
Registered: Jul 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Here is snippet of my script

echo "enter url"
read val
echo "enter file name "
read file
let cnt=0
while read -r line
do
arr[$cnt]="$line"
x=${arr[cnt]}
cnt=$(( $cnt + 1 ))
cd /cygdrive/c/nutch
bin/nutch readseg -get crawl/segments/$x $val -nogenerate -noparse -nocontent -noparsetext >>out.txt
done < <(ls -1 /cygdrive/c/nutch/crawl/segments)
 
Old 07-08-2013, 05:56 AM   #7
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
Why do you expect /cygdrive/c on Linux to be what it was in cygwin?

If this is a dual boot system and you want to access your Windows c drive that way, you could mount it that way. But did you?

Anyway, I'm pretty sure you are not having a problem with "process substitution". You are having a problem with a script that includes a hard coded path for its data directory. You are running that script on a system where that data is located somewhere else.

Do you have a nutch directory somewhere in the linux system with similar contents to what it had in Windows?
Even if you do, it appears nutch/bin/nutch.exe is a windows program that your script depends on. Do you have that recompiled as a Linux program nutch/bin/nutch?

If you have a nutch directory on Linux, with anything that was originally non portable converted to Linux compatible, then you could set up a symlink or mount so that /cygdrive/c on Linux points to the directory containing nutch. Alternately, you could edit the script and replace /cygdrive/c wherever it occurs with the directory containing nutch.

Last edited by johnsfine; 07-08-2013 at 06:07 AM.
 
Old 07-08-2013, 08:16 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,702

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Also doing a "cd /cygdrive/c/nutch" in a loop isn't necessary - do it once outside the loop and you will be done with it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[bash] why is Process Substitution <() so much faster ?! hashbang#! Programming 4 11-26-2010 04:19 AM
Process Substitution not working with echo command muazfarooqaslam Linux - Newbie 1 02-04-2008 09:10 AM
Problems with Process Substitution and scp - Solaris to Linux sdduuuude Linux - Newbie 3 09-28-2007 10:47 AM
Bash Process Substitution joshholt Programming 4 10-11-2005 03:15 AM
process substitution jk3us Linux - Software 1 12-02-2004 04:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:12 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration