Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 28 Nov 2014, 05:53
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
"env" variable problem? [ Solved ]
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [37 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 18 Jun 2012, 03:21    Post subject:  

jpeps wrote:
Check what shell you're using: "ps | grep $$"

Code:
echo $0

instead of $$
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 18 Jun 2012, 03:27    Post subject:  

there are configfiles .Xresources and .Xdefaults .

mrxvt also has a .mrxvtrc configfile i think .

not sure about rxvt/urxvt .
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Mon 18 Jun 2012, 07:34    Post subject:  

SOLVED.!

It seems that I found at least "one" variable that won`t work. Lucky me...

First the variable APP_LIB worked fine, so I got suspicious.
I changed APP_DIR to APPDIR and it works fine.
I`m guessing that App_Dir would probably work also.

There`s a few existing env variables that have _DIRS or DIR in them:
Code:
XDG_CONFIG_DIRS=/etc/xdg
XDG_DATA_DIRS=/usr/share:/usr/local/share
XFINANSDIR=/root/.xfinans

But it doesn`t seem that there would be a name space conflict here.
Odd.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 18 Jun 2012, 07:55    Post subject:  

maybe it had been
Code:
App _Dir

(space) (typo) ?

Don't know if such things would break login
ie
App _Dir=/path
login App : command not found
.
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Mon 18 Jun 2012, 09:06    Post subject:  

No, I rewrote it so many times, it couldn`t have been wrong all of them.
You could try setting APP_DIR in profile.local and see if it does it for you.

The results are consistent, something just doesn`t like _DIR .
The new variables APPDIR and APPLIB work very well.
So I don`t have a broken system after all.
At least not any more broken than Puppy and Linux are already. Wink

Thanks Karl and everyone... Terry
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Jun 2012, 09:59    Post subject:  

sunburnt wrote:

At least not any more broken than Puppy and Linux are already. Wink



...except the problem isn't Puppy or Linux
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4380

PostPosted: Mon 18 Jun 2012, 10:22    Post subject:  

Is /bin/sh pointing to bash or busybox and do you have stock puppy bash, because bash can be configured to have different behavior when called as sh.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Mon 18 Jun 2012, 10:59    Post subject:  

technosaurus wrote:
Is /bin/sh pointing to bash or busybox and do you have stock puppy bash, because bash can be configured to have different behavior when called as sh.


Yes i noticed this at the prompt .
Though autologin/login the prompt semms to be different on / and on /root .

Also using vi or vim keyboard behavior acts different . To get tab auto completion i need to type bash at the prompt, otherwise i get

# ls--->
instead of
# ls
ls
lspci

Laughing
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Mon 18 Jun 2012, 19:54    Post subject:  

Hi jpeps; Do you know what the problem is?
I figured it was something in the env handling that didn`t like what it thought were dups.
It seems to be the case anyway.

Yo... technosaurus; Stock Lucid Puppy528-005 bash, and /bin/sh => /bin/bash

I`ll look at configuring bash, we`ve been trying to do that in another thread.
Wanted 3 CLI behaviors, mime, run RoxApps, and a multi. link junction.
All currently use a script, but all have to be built-in bash behaviors.

Hey Karl; Different behaviors at different times shows there`s a lot going on. Simplify!
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Mon 18 Jun 2012, 20:35    Post subject:  

APP_DIR is eaten by Rox. From ROX changelog:
Code:
21-Jul-2000
~~~~~~~~~~~
In the path entry minibuffer, an exact match is favoured over any other
match. So, if you enter '.xsession' and press Return you'll get it, not
'.xsession-errors' or whatever!

The filer now clears APP_DIR from the environment so that child processes
don't get it. Fixed a bug which caused problems when using a small version
of the 'missing image' image.


If you launch terminal (rxvt) *NOT* from Rox, but from elsewhere (e.g. from JWM / menu) by choosing JWM menu --> terminal, you will see your APP_DIR is still there Very Happy

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Jun 2012, 20:44    Post subject:  

sunburnt wrote:
Hi jpeps; Do you know what the problem is?


You have to use unique variable names. APP_DIR is probably used by something else. If people gives examples that work, it's a good idea to try the posted code.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Mon 18 Jun 2012, 21:28    Post subject:  

jpeps; I think jamesbond has nailed it... Kinda what I was saying.

jamesbond; I figured APP_DIR still existed, just a different shell than rxvt.

Goes along with my statement that there`s lots going on.
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Jun 2012, 22:31    Post subject:  

APP_DIR will work as an alias in .bashrc, but doesn't work as a variable name in the /etc/init.d folder. It doesn't matter how or what terminal you load, or what shell you are in. To me, that means it's a reserved variable name.


"Variable names

Since all reserved variables are UPPERCASE, the safest way is to only use lowercase variable names. This is true for reading user input, loop counting variables, etc., … (in the example: file)

prefer lowercase variables
if you use UPPERCASE names, do not use reserved variable names (see SUS for an incomplete list)
if you use UPPERCASE names, at best prepend the name with a unique prefix (MY_ in the example below"

http://wiki.bash-hackers.org/scripting/style
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Tue 19 Jun 2012, 01:05    Post subject:  

Makes sense, I usually use leading capitals, so that works well.

This is the first time I`ve run into a name space problem like this.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2279

PostPosted: Tue 19 Jun 2012, 03:55    Post subject:  

In order for any variable to be available in the environment in which a program runs, it has to be exported properly, or passed on the command line before the call to the program:
Code:

unset APP_DIR
export APP_DIR
program-to run
# or:
APP_DIR=/path/to/somewhere program-to-run

Unsetting cleans up any existing APP_DIR value. APP_DIR is not a 'proprietary' enivronmental variable.

Why don't you simply get and use APP_DIR as the current directory. When an AppRun script is run it can find out where it is at:
Code:
# Check for links and get APP_DIR
if [ ! -L "$0" ] ; then
   APP_DIR=`dirname "$0"`
   APP_DIR=`cd "$APP_DIR";pwd`
elif [ ! -z `which readlink 2> /dev/null` ] ; then
   APP_DIR=`readlink -f "$0"`
   APP_DIR=`dirname "$APP_DIR"`
else
   echo "$PROG: Can't get real path to AppRun!" 1>&2
fi
export APP_DIR
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [37 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0794s ][ Queries: 11 (0.0043s) ][ GZIP on ]