Bash menu not running

Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 03-27-2015
Bash menu not running perl code

The perl command is not executing? I am trying to run the .pl in my cygwin home directory (C:\cygwin\home\cmccabe) using ${id}.txt.hg19_multianno.txt (located in the annovar directory) as the input file to be formatted and $FILENAME is the output file to be saved. The .pl is attached as well. Thank you Smilie.

Code:
 
matrix() {
     printf "\n\n"
     
     cd 'C:\Users\cmccabe\Desktop\annovar'
     my $FILENAME = 'L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_${id}.txt';
     $( perl -ne 'chomp; system ("perl ~/matrix.pl < ./${id}.txt.hg19_multianno.txt")' > )$FILENAME) )
	 
	 printf "Process complete and new file saved in ($FILENAME), Are there additional target gene patients? Y/N "; read match_choice
	 
	 case "$match_choice" in
	    [yY]) id=""; menu ;;
        [nN]) id=""; printf "\n Goodbye! /n/n " ;;
		esac
}


Last edited by cmccabe; 03-27-2015 at 02:53 PM..
# 3  
Old 03-27-2015
The bash menu runs now, but the perl command hangs up and doesn't run. I mix between so many different shell scripting because many of the programs that I use are academic and open-source, written in a specific language. Thank you Smilie.
# 4  
Old 03-27-2015
What do you expect your shell to do with
Code:
     my $FILENAME = 'L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_${id}.txt';

?
And what with
Code:
     $( perl -ne 'chomp; system ("perl ~/matrix.pl < ./${id}.txt.hg19_multianno.txt")' > )$FILENAME) )

Me, I don't have the slightest clue of perl, but I'd doubt it accepts four closing parentheses when it had only two opening ones. And I'd doubt it to be efficient to have perljust run "system" with another perl call.
# 5  
Old 03-27-2015
The hope was to store the output directory as a variable ($FILENAME) but I don't think that is the right way to do it. I changed the code to the below and put the .pl in the annovar directory to make it easier.

The overall goal is use ${id}.txt.hg19_multianno.txt as the input file and after the perl script is run on that file the output file is saved to the path L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_${id}.txt . Thank you Smilie.

Code:
matrix() {
    
     cd 'C:\Users\cmccabe\Desktop\annovar'
     $( perl -ne 'chomp; system ("perl matrix.pl < ${id}.txt.hg19_multianno.txt" )' >> L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_${id}.txt
	 
	 printf "Process complete and new file saved in, Are there additional target gene patients? Y/N "; read match_choice
	 case "$match_choice" in
	    [yY]) id=""; menu ;;
        [nN]) id=""; printf "\n Goodbye! /n/n "; sleep 2 && exit ;;
		esac
}

# 6  
Old 03-27-2015
Help me out - in that perl line - what it the result of (opening parentheses - closing parentheses)?
# 7  
Old 03-27-2015
I'm not sure which one you are referring to but the $( perl - ne is how I call a perl script in bash.

Does this help?
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Bash Menu using zenity allen11 Shell Programming and Scripting 2 10-08-2018 04:47 PM
Bash menu item counter annacreek Shell Programming and Scripting 7 08-08-2018 09:47 AM
Display user selction from bash menu cmccabe Shell Programming and Scripting 4 08-20-2016 11:08 AM
New bash menu printing errors but closes too quickly cmccabe Shell Programming and Scripting 12 10-28-2015 03:43 PM
Special case to skip function in bash menu cmccabe Shell Programming and Scripting 1 10-28-2015 05:36 AM
Bash menu opens and closes cmccabe Shell Programming and Scripting 13 03-13-2015 05:04 PM
Bash Script - Whiptail Menu Help! malfolozy Shell Programming and Scripting 8 07-15-2014 09:12 AM
Bash: menu-complete and reverse ozkanb Red Hat 0 04-10-2013 10:03 AM
Simple bash script menu fusetrips UNIX for Dummies Questions & Answers 2 01-13-2013 05:46 AM
get chosen value from bash menu olearydc Shell Programming and Scripting 9 08-19-2012 03:17 PM
Help regarding a bash menu script Vitrophyre Shell Programming and Scripting 5 04-06-2010 01:55 AM
Execute interactive bash menu script in browser with PHP nck Shell Programming and Scripting 1 12-14-2009 08:21 PM
Bash menu script AngelFlesh Shell Programming and Scripting 3 11-29-2009 06:31 PM
Presenting the user a menu in Bash ... ckoeber Shell Programming and Scripting 4 10-10-2008 12:34 PM
Drop down menu in bash for timezone select simonb Shell Programming and Scripting 1 04-29-2006 02:02 PM