|
From: carlos.juvenal on 8 Apr 2008 06:36 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
From: Maxwell Lol on 8 Apr 2008 13:00 carlos.juvenal(a)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.
|
Pages: 1 Prev: finding and copying the files to another location Next: need help urgently |