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.
|
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. |
Problem is when running script on linux machine it is showing problem with line- done < <(cat pattern.txt)
|
I think you will need to show us the script and the error it generates.
|
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 |
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) |
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. |
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 11:44 PM. |