In addition to what vgersh99 and Corona688 said, I have a few concerns with your loop:
Please get used to lining up do and done; it makes it easier to see the structure of your code (especially when you have longer loops).
The printf utility needs a format string. Assuming that user entered data WILL NOT contain any percent signs and WILL contain newlines leads to extremely unreliable output and possible syntax errors.
The >> keyword is a redirection operator; not a command separator.
The command: printf ${hgvs[$i]} >> cd 'C:' c:/Users/cmccabe/Desktop/Python27/syntax.txt (assuming hgvs[$i] does not contain a %) appends the expansion of hgvs[$i] into a file named cd and ignores the other two operands. If hgvs[$i] expanded to %s\n, it would append lines containing C: and c:/Users/cmccabe/Desktop/Python27/syntax.txt to a file named cd.
Even if an array was created using read -a array_name, it is still a good idea to quote expansions of array elements (especially when the setting of IFS is different when running read than it is when expanding the elements, as it is in this case).
Assuming that you are trying to log the elements of your array as separate lines into the log file c:/Users/cmccabe/Desktop/Python27/syntax.txt, you want something like I suggested in one of your other myriad recent threads:
or, more simply,
This User Gave Thanks to Don Cragun For This Post:
Hi, all,
I try to run a quite simple bash script mytest.sh in cygwin, it's content is:
#!/bin/bash
echo "It is my first bash shell"
there are three lines in the script. The second line is blank line.
When I run it use command: bash c:/mytest.sh, ... (6 Replies)
Hi!
I want to run/execute a bash script automatically everytime when a specific file is created or when its timestamp changes. Is this possible? How?
Thank you very much for your answers in advance,
Regards,
Christoph (1 Reply)
hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Hi All,
I want to run a bash script using perl. But they are in the different dir.
#! /usr/bin/perl -w
use strict;
my $root=`pwd`;
chomp($root);
my $cmd=".$root/testdir/ft_623.sh 3 4 5 6 7";
print $cmd;
my @line=`$cmd`;
foreach (@line){
print $_;
}
ft_623.sh (0 Replies)
Is there a way to run some code in a C-shell script by different shell, like bash?
I have that situation.
I have prepared and perfectly workable bash-skript that now I have to execute under C-shell script, divide it on steps and without creating a new files (with the bash-code parts.)
For... (6 Replies)
I am having trouble with bash. I am trying to put a command in an if statement and then compare it to a string.
This works perfectly.
echo $(ipcs | grep Shared | awk '{print $2}')When I put it in an if statement I get some problems.
$ if ; then echo expression evaluated... (10 Replies)
Is it possible to run a bash using a by creating an icon or shortcut in windows 7? Everything seems to be for unix or linux and unfortunately my institution is windows.
For example, run bash ~/newbatch.sh by clicking on an icon on a users desktop. Cygwin will be installed as well. Thank you... (8 Replies)
How to run several bash commands put in bash command line without needing and requiring a script file.
Because I'm actually a windows guy and new here so for illustration is sort of :
$ bash "echo ${PATH} & echo have a nice day!"
will do output, for example:... (4 Replies)
If run the below code today its creating all directory and getting output files,I f run same code tomorrow I am getting error.
can any one give suggestion to sortout this error.
OSError: no such file or directory : '062518'My code looks like this
import paramiko
import sys
import os ... (8 Replies)