Bash on Fedora error on basic script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash on Fedora error on basic script
# 1  
Old 10-26-2019
Bash on Fedora error on basic script

I am not able to execute bash script on Fedora. They were running on another environment. This is a sample script:
Code:
#!/usr/bin/bash
input="./data/heu/hout1"
i=1
j=0
while IFS= read -r file1
do
#Some code here
done < "$input"


#echo $j

I get an error:
bash: s.sh: command not found...

s.sh is the name of the file.

If I change the first line to
Code:
#!/bin/bash

I still get the same error. Appreciate your help.
# 2  
Old 10-26-2019
You need to insure the script is in your path (environment).

One way ahead is to use the full path to the script. There are other ways to solve this problem as well.

Maybe post back the output of:

Code:
ls -l s.sh

.. if you need more help.
This User Gave Thanks to Neo For This Post:
# 3  
Old 10-26-2019
Does the script have x (execute) permission for your current user?
# 4  
Old 10-26-2019
Thanks, adding the current directory to Path did the trick.
This User Gave Thanks to ngabrani For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Fedora

Bash shell problem on Fedora Linux

My shell environment is bash and desktop environment is LXDE. When I use the up and down button on the keyboard to view the command history on bash shell, many times part of the command from the history remains on the line. For example /home/milhan > ssh somedomain.org /home/milhan > then when I... (5 Replies)
Discussion started by: milhan
5 Replies

2. UNIX for Beginners Questions & Answers

Beginner bash - basic shell script 'while' help...

Hi everyone, first time visitor to these forums here. Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies

3. Shell Programming and Scripting

Basic Bash algorithm with sum/subtraction

Hi all, i'm making some test on a data file. Imagine i have two columns inside it : 80377,20 80377,20 80379,19 80378,20 80380,20 80382,20 80381,21 Just to understand how can it works, imagine to subtract 100 to the number in the first column when the other one in the second... (4 Replies)
Discussion started by: Board27
4 Replies

4. Shell Programming and Scripting

Help in making a basic bash script

Hi All, I am trying to monitor CPU load of few processes, with the same name. The output that I get from top is the following 28171 root 20 0 1089m 21m 3608 S 103 0.3 15:16.89 /opt/ppp//h264rtptranscoder.bin --videoPort=14504 --audioPort=14505 27589 root 20 0 1060m 23m... (3 Replies)
Discussion started by: liviusbr
3 Replies

5. Shell Programming and Scripting

Basic bash, echo in loop for

Hi, I am trying to make a script to manage log. I want to write the name of the .gz I moved and the date : for i in `ls $replog/*.gz` do echo " $i " `echo $i date +%d:%m:%Y` `echo $datee `>> $replog/mrnet.log mv $i /var/log/vieux-logs done I need to echo... (10 Replies)
Discussion started by: Dabless
10 Replies

6. Shell Programming and Scripting

Basic bash -- pulling files from an FTP server

Hi guys. Very new to this so apologies if this is ridiculously obvious, but I am not sure why this isn't working. I want to pull a file off an FTP server. I currently do it through windows, which is no problem, but I want to move everything to a Linux box I just installed. wget won't work as the... (4 Replies)
Discussion started by: majormajormajor
4 Replies

7. Shell Programming and Scripting

Monitoring a file - Basic Bash Question

*This is not homework I am new to UNIX and want to try this Monitoring a file demo* *If this is the wrong forum please move it - im new to the forums* $1 = the file to be monitored $2 = the time for the file to sleep If the file gets changed (using -nt) it will send my username mail saying... (2 Replies)
Discussion started by: Nolan-
2 Replies

8. UNIX for Dummies Questions & Answers

Basic Unix bash script help

Hello there Been using Unix bash scripting for two days now so am very new to this. I am currently doing a project now and i'm basically making a noughts and crosses game (or tic tac toe). I have created the board using an array. When I try and check to see if the array is empty using an If... (3 Replies)
Discussion started by: ChrisHoogie
3 Replies

9. Shell Programming and Scripting

Basic bash 'for loop' usage

Hi! I have a simple question about using a for loop. I'm trying to open up all the zip files in the currect directory with ark, but I am getting the error "bash: syntax error near unexpected token `for $i ; do ark $i ; done ; I looked in the info pages for bash, but I can't seem to figure... (2 Replies)
Discussion started by: Orange Stripes
2 Replies

10. UNIX for Dummies Questions & Answers

Why do basic unix commands not work in BASH

Why do basic unix commands such as "ls" not work in "BASH" mode?? I am frustrated!! (10 Replies)
Discussion started by: PixelLover
10 Replies
Login or Register to Ask a Question