NOTE: /etc/bashrc has warnings about modifying it which likely should be heeded, instead relying on its recommendations to put customizations in another file that it calls automatically.Īnd this outputs on my little laptop/fedora server sitting next to me in my home office, demonstrating similar command execution from its. I checked and that, too, worked as expected. bashrc templates have this in them: #Source global definitions In this tutorial, you will learn to use the pwd command. Use the pwd command to find your way in the Linux file system structure maze or to pass the working directory in a Bash script. That said, I'm guessing that if you want your reminder to work for everyone, then you would simply put it in /etc/bashrc, as all my. Introduction The pwd Linux command prints the current working directory path, starting from the root ( / ). And they're easy to check - log out and back in!! bashrc file that loads every time I log in. I have a number of commands at the end of my. Not sure how/why, but in 2023 all of these workarounds are superfluous on AWS EC2 running Amazon Linux, and I suspect on other Linux as well. I see this was last asked 10 years ago, but us noobs keep coming along. As mentioned, it really isn't the way to do it, but works for now. This soulution assumes having automatic log-on set up. Running the script with an explicit interpreter. It is therefore the interpreter that is 'not found', not the script itself. Su - YOURUSERNAME -c '/usr/local/bin/script_file.sh -optional -flags' On a Unix system, a carriage return is an 'ordinary character' and not at all part of the line termination, which mean that it tries to start /bin/shr to run your script, and then fails as that file does not exist. # Run the script as YOURUSERNAME instead of root: Until ] & ] doĮcho "Xserver hasn't started or other error occurred. # Wait until X is running and required user logged in: # Description: runs '/usr/local/bin/script_file.sh -optional -flags' at startup, when xserver has started and YOURUSERNAME is logged on. # Provides: script_file.sh startup at boot Since my script requires xserver and user to be logged on, I created initfile which waits after bootup for xserver and user to be logged on and then executes the script: #! /bin/bash Don't know why it doesn't work for me perhaps it has something to do with my display manager auto logon workaround, just a guess.Īnother solution would be adding script shortcuts to global file that gets executed at startup, for instance /etc/rc.local. It's dirty one though.įirst of all, using ~/.bash_profile, ~/.bash_login, ~/.profile or even /etc/profile.d/ should be preferred methods instead (here's good reading on the subject). Okay, I've found a solution to my initial problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |