10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear all Linux lover,
I am a new learner to Bash Shell script and I would like to writing a script to to repeat my script.
This mean I would like to have multiple same of result after running the .sh.
#######
TIMES_NO=0
echo -n "Please enter the number for times to repeat ?"
read... (10 Replies)
Discussion started by: Rocky888
10 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am using a for loop to manipulate files data_1.txt through data_100.txt. The for-loop is set up like this:
for i in {1..100}; do cut -f1 data_$i.txt > output$i.txt
I get the following error message when I run the code:
cannot open `data.txt' for reading: No such file or directory... (4 Replies)
Discussion started by: evelibertine
4 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I am trying to create a matrix of 0's and 1's depending on whether a gene and sample name are found in the same line in a file called results.txt. An example of the results.txt file is (tab-delimited):
Sample1 Gene1 ## Gene2 ##
Sample2 Gene2 ## Gene 4 ##
Sample3 Gene3 ... (2 Replies)
Discussion started by: InfoSeeker2
2 Replies
4. Shell Programming and Scripting
Below is a test script I was trying to use so that I could understand why the logic was not working in a larger script. While accessing and printing array data inside the while loop, everything is fine. Outside the loop, i guess everything is null?? The for loop that is meant to cycle... (4 Replies)
Discussion started by: adlmostwanted
4 Replies
5. Shell Programming and Scripting
I'm trying to do a script where I want to see if all users home directories are only writable by owner. However, in my script I do not know how to implement the for loop so that all directories are checked. In mine, I am only checking the permissions for the first directory found. I do know that a... (3 Replies)
Discussion started by: detatchedd
3 Replies
6. Shell Programming and Scripting
hi
i was trying to optimize one script and i came across this problem .. i am putting some pseudo code here
$ >cat a.sh
ls | while read I
do
i=$(($i + 1))
done
echo "total no of files : "
$ >ksh a.sh
total no of files :
$ >bash a.sh
total no of files :
why is... (1 Reply)
Discussion started by: zedex
1 Replies
7. UNIX for Dummies Questions & Answers
It is happening with my sessions already second time: a 'for'-loop for some reason stop to work as expected.
That means or it is looping without exitting, or it is not loop even once.
Here example of my try when it is not processing even one loop.
You can see, I start new subshell and... (14 Replies)
Discussion started by: alex_5161
14 Replies
8. Shell Programming and Scripting
i have this code for a simple if loop:
#!/bin/bash
array="1 2 3 4 5"
array2="5 6 7 8 9"
if } -gt ${array} ]; then
echo "${array2} is greater than ${array}!!"
fi
the error is
./script8: line 9: [: too many arguments
./script8: line 9: [: too many arguments
./script8: line 9: [:... (10 Replies)
Discussion started by: npatwardhan
10 Replies
9. Shell Programming and Scripting
Hi,
I'm having a problem with the while loop in bash. I try the following script:
#!/bin/bash
while true
do
echo "test"
done
When I try this, it gives me this error:
while: Too few arguments.
What am I doing wrong?
Thanks (5 Replies)
Discussion started by: Kweekwom
5 Replies
10. Shell Programming and Scripting
I'm just trying to make a script that runs in command line to echo each line in a text file. Everything i found on google is telling me to do it like this but when I run it it just echos removethese.txt and thats it. Anyone know what im doing wrong?
for i in removethese.txt; do echo $i; done
... (4 Replies)
Discussion started by: kingdbag
4 Replies