Bash Script Probleme with my variable

hello all

hi have a probleme with my bash my variable not works

files= ./home/files

  while read line           
do           
    python $files/adnplay.py $line           
done <$files/adnvideo.txt 
            break
            ;;

Open in new window


i need help
GaaaraAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GaaaraConnect With a Mentor Author Commented:
i got the solution :)

I wrote the variable Outside the munu  it works
0
 
woolmilkporcConnect With a Mentor Commented:
Omit the space and use quotes (optional):

files="./home/files"

Please keep in mind that the path "./home/files" is relative to the current working directory!

"break" and ";;" are in the wrong places, or did you post just a part of the script?
0
 
GaaaraAuthor Commented:
yes is a part of script :)

no is not work

http://pastebin.com/w53cfdHF
script
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
woolmilkporcCommented:
"no is not work" is a rude and discorteous but not a sufficient reaction to my suggestions.
0
 
GaaaraAuthor Commented:
sorry my english is bad and I said that it did not work in the words which I know I did not want to be offend
0
 
woolmilkporcCommented:
It's not your English.  Just "it did not work" without any further explanation is not a bit better than your previous answer.
0
 
GaaaraAuthor Commented:
ah ok :)

i test your suggestions
my complete bash script
http://pastebin.com/w53cfdHF


files = "./files"

Open in new window


and i have a error

adnvideo.txt: No such file or directory

Open in new window


If the text is taken into the script it gives
python: can't open file 'adnplay.py': [Errno 2] No such file or directory
python: can't open file 'adnplay.py': [Errno 2] No such file or directory
python: can't open file 'adnplay.py': [Errno 2] No such file or directory
python: can't open file 'adnplay.py': [Errno 2] No such file or directory

Open in new window

0
 
woolmilkporcCommented:
I said "Omit the space", Why did you add spaces around the = sign" instead?

files="./files"
0
 
GaaaraAuthor Commented:
I removed the space and it gives the same thing

i execute the script in the home folder
and the folder "files" Is has the root of the script directory
0
 
GaaaraAuthor Commented:
... without variable it works ...
0
 
woolmilkporcCommented:
You're still aware that "." means "current directory", so that the path "./files" is relative to whatever directory you're in?
0
 
GaaaraAuthor Commented:
yes I know it  the "." is current directory  :)


      
why this line detect de files**$files/HD.py** ans my line in the loop not works
0
 
TintinConnect With a Mentor Commented:
Add the following code just before your while loop:

if [ ! -f $files/adnplay.py ]
then
     echo "$files/adnplay.py does not exist or is not readable"
    exit 1
fi

Open in new window

0
 
GaaaraAuthor Commented:
i have this  
/adnplay.py does not exist or is not readable

Open in new window


the variable I think that the variable is blocked
	

#!/bin/bash
# Bash Menu Script Example

PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
           files="./files"
readable is ok 
break
            ;;
        "Option 2")
is not readable
            while read line           
do           
    python $files/adnplay.py $line           
done <$files/adnvideo.txt 
            break
            ;;
        "Option 3")
            echo "you chose choice 3"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

Open in new window

0
 
ozoConnect With a Mentor Commented:
files="./files" is set in "Option 1")
but $files/adnplay.py is used in "Option 2")
0
 
GaaaraAuthor Commented:
yes I did not know that it would work not in the others option thus solved
0
 
GaaaraAuthor Commented:
I've requested that this question be deleted for the following reason:


it is not necessary to continue :) thank you all for your help
0
 
TintinCommented:
gaaara had their problem solved with our help.   I suspect the language issue might be the reason they requested a delete.
0
 
GaaaraAuthor Commented:
ty for your help  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.