LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   variables can't read home directory (https://www.linuxquestions.org/questions/linux-newbie-8/variables-cant-read-home-directory-4175516232/)

rbees 08-24-2014 08:16 PM

variables can't read home directory
 
I am trying to run a scrip that has variables like

$STORDIR
$TEMPDIR
$WORKDIR

when I try to do
Code:

user:~/BDay$ $STORDIR="$HOME/BDay"
bash: =/home/user/BDay: No such file or directory
user:~/BDay$ pwd
/home/user/BDay

to manually set the variable to see what happens but I get the above error about no such file....

Well it is there and I am working out of that directory.

The permissions on the files are correct.

I do use Debian Testing, currently called Jessie

Any ideas?

Thanks

smallpond 08-24-2014 08:52 PM

Read the error again. It is not saying that you have no /home/user/BDay, it is saying you have no =/home/user/BDay.

rbees 08-24-2014 09:11 PM

well I thought that $STORDIR=/$HOME/BDay was how you set a variable from the command line. Is that not right? Nope.

STORDIR=/$HOME/BDay would be correct. Now it works.

Still does not explain why the script running as the local user can not write the output file to the local users directory.

pwalden 08-24-2014 10:50 PM

It should be

STORDIR=$HOME/BDay

Quote:

Still does not explain why the script running as the local user can not write the output file to the local users directory.
You never shared your script or your file and directory permissions.

rbees 08-25-2014 04:37 AM

The script is at

https://github.com/rbees/Birthday-Blessings

the permissions are 644 or 755 depending on the file/folder

all are owned by the local user

the script runs fine on a different machine

so the issue is with my laptop

the scripts were written by a well experienced guy

grail 08-25-2014 09:01 AM

So is there still an issue? If so, what is it and what errors are you receiving?

rbees 08-25-2014 12:29 PM

Thanksn

None, and that is just it. The other day we tried to debug over the phone but only discovered that for some reason my system will not write the output file to $STORDIR

I tried to run it in one of my vms but they all seam to have some kind of an issue themselves so that the shared folder is not accessible. Guess I will have to install a new one.

I have tried putting echo statements in to see if I could figure out where it is failing, but no joy.

rbees 08-26-2014 04:42 AM

I can confirm that what ever the issue is, it is specific to my laptop. I set up a Debian Testing (Jessie/current) VBox Vm, same as my laptop and did the setup and the scripts run fine.

If you had some idea I would be glad to investigate, but my time to play is very limited.

Thanks.

jpollard 08-26-2014 06:10 AM

First lose the idea that $STORDIR is a variable. It isn't. What it directs the shell to do is replace the string "$STORDIR" with the value of the "STOREDIR" variable.

Second, on the face of it, the STOREDIR is local variable - that means that processes will NOT get it. To have it exported to processes you have to export it "export STOREDIR". You can even say "export STOREDIR=..." to get it assigned and exported at once.


All times are GMT -5. The time now is 06:59 PM.