Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You folks are helping me in learning Shell script. This is the problem I am facing. Currently I have an alias which will change for every host
$ cat ~sapadmin/.profile | grep myloc
alias myloc='cd /export/nfs1-34/`
I have my own .bashrc file which i will use and i cant load them so i tried to do some stuff in my file.. using xargs but am not able ... All i need is when i do that cat the alias should get executed.
you can manually "import" settings from a file using source:
Code:
source <this is the filename>
# and now you can use your alias
myloc
# that's all
----------------------------------
# also
# do not write:
cat ~sapadmin/.profile | grep myloc
# but
grep myloc <filename>
# next time
As said mine is different requirement
When I source by .bashrc file it should set the alias . Since alias myloc
Is different for each host so I have my .bashrc which is unique
So when I source .bashrc I should get the myloc info from .profile and
It should be set in .bashrc
Our default shell is ksh so we are using .profile and we set alias myloc in .profile on
Thousands of hosts. I like bash so I am planning to create my own .bashrc
Which will remain unique I.e get the values from .profile
So people will set alias myloc in .profile since I don want to edit my .bashrc
On each host I like to get that value from .profile and getting executed when I source .bashrc
you misunderstood
into .bashrc you can instert a small function or similar to create a temporary file containing what you need and also you can source that file
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.