. myprofile

. myprofile

am 08.04.2008 12:36:32 von carlos.juvenal

How can I get the name and dir of myprofile file that I have dotted ?

Example:
/tmp/myprofile whose content is:
Me=Take_this_filename
Mydir=Take_the_dir_where_this_file_lives


Executing ( Dot . followed by a space + filename )
. /tmp/myprofile or . myprofile The var $Me should
provide the name of the file. ie. myprofile !
and $Mydir
the value /tmp/myprofile

Any ideas ?

Thank you,
Carlos

Re: . myprofile

am 08.04.2008 19:00:54 von Maxwell Lol

carlos.juvenal@gmail.com writes:

> How can I get the name and dir of myprofile file that I have dotted ?

It's hard to do this in general. Consider
cat /tmp/myprofile | sh -
where is the file located?

Here's one solution: Put it in when you create myprofile.

file=myprofile
dir=/tmp
echo Me=$file >$dir/$file
echo Mydir=$dir >>$dir/$file
cat rest_of_myprofile >> $dir/$file

The other way is to change the script. If you have a script that
KNOWS the filename, and READS the file, then there is the perfect
place to determine the information you want.