LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cygwin process substitution issue (https://www.linuxquestions.org/questions/linux-newbie-8/cygwin-process-substitution-issue-4175468574/)

dev_linux 07-05-2013 05:42 AM

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.

eklavya 07-05-2013 06:01 AM

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.

dev_linux 07-05-2013 06:33 AM

Problem is when running script on linux machine it is showing problem with line- done < <(cat pattern.txt)

jpollard 07-05-2013 06:40 AM

I think you will need to show us the script and the error it generates.

shivaa 07-05-2013 08:08 AM

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

dev_linux 07-08-2013 01:01 AM

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)

johnsfine 07-08-2013 05:56 AM

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.

jpollard 07-08-2013 08:16 AM

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.


All times are GMT -5. The time now is 07:18 AM.