Two comments without being able to dive deeper into your logics nor being able to test anything:
- Using the file variable in several places (select file ...; for file ...; read -r file ...) you overwrite the previously defined value. This may not be want you want...
- in your while read -r ... loop (BTW, why a loop here?) without redirection you read from the terminal. Is that what you want ?
No, I am just trying to selct one file in the directory and save it in a new directory. You are correct a loop is not needed.
Search directory with files file1.txt is selected and saved in the new directory (/home/cmccabe/Desktop/NGS/panels/reads/)
So do I just need to read that selection into a variable and pass that to the new directory, or is there a better way? Thank you .
Maybe:
error
Perhaps you might profit of programming a bit more defensive. Meaning, check your variables and value returns, etc, before assuming that it contains what you think.
Also, set -x in the beginning of your shell does display what is going on as it executes the program. Maybe even set -vx for verbosity.
Concerning your work flow I do not see a reason to not make something like this:
If you want the user to repeat the process of choosing, wrap the select block within a conditional loop. In the loop you must check by what criteria it must stop.
#!/bin/bash
X=(2H 4S 10D QC JD 9H 8S)
How do I unset the 10D from this array and save it to a file?
Please use CODE tags as required by forum rules! (5 Replies)
In the bash below the oldest folder in a directory is selected. If there are 3folders in the directory /home/cmccabe/Desktop/NGS/test and nothing is done to them (ie. no files deleted, renamed) then the bash correctly identifies f1 as the oldest. However, if something is done to the folder then... (4 Replies)
In the bash below I am asking the user for a panel and reading that into bed. Then asking the user for a file and reading that into file1.Is the grep in bold the correct way to apply the selected panel to the file? I am getting a syntax error. Thank you :)
... (4 Replies)
The `bash` below uses the oldest folder in the specified directory and logs it. The goes though an analysis process and creates a log. My problem is that if there are 3 folders in the directory folder1,folder2,folder3, the bash is using folder2 for the analysis eventhough folder1 is the oldest... (0 Replies)
I am using bash to prompt a user for a choice using: where a "y" response opens a menu with available panels that can be used.
while true; do
read -p "Do you want to get coverage of a specific panel?" yn
case $yn in
* ) menu; break;;
* ) exit;;
* ) echo... (6 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi there.
i have created a program that in the end it will give output like this
1 2 3 4 5
10 9 ... (1 Reply)
Hi there.
i have created a program that in the end it will give output like this
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
.............. 17
i wonder how to save the output into a single string and into a file.
i.e 1 10 11 12 9 2 3 8 13 14 7 4 5 6 15 17 (in this order,... (3 Replies)
Hi
I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data.
I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Hi,
I'm trying to write a function that redirects the contents of an
array to a file. The array contains the lines of a data file with
white space.
The function seems to preserve all white space when redirected
except that it seems to ignore newlines. As a consequence, the
elements of the... (7 Replies)