Re: current directory and use of login scripts
Daniel L Newhouse <[email protected]> Wed, 26 May 2021 19:45:13 -0500
| Newsgroups | alt.comp.cygwin |
|---|---|
| Organization | Forte - www.forteinc.com |
| Message-ID | <[email protected]> |
On Fri, 23 Apr 2021 15:31:46 -0500, Daniel L Newhouse <[email protected]> wrote: Usually, do not use the .profile script. Furthermore, One advantage of bashs ability to look for either synonym is that you can retain your .profile if you have been using the Bourne shell. If you need to add bash-specific commands, you can put them in .bash_profile followed by the command source .profile. When you log in, all the bash-specific commands will be executed, and bash will source .profile, executing the remaining commands. If you decide to switch to using the Bourne shell you dont have to modify your existing files. A similar approach was intended for .bash_login and the C shell .login, but due to differences in the basic syntax of the shells, this is not a good idea. .bash_profile is read and executed only by the login shell. If you start up a new shell (a subshell) by typing bash on the command line, it will attempt to read commands from the file .bashrc. This scheme allows you the flexibility to separate startup commands needed at login time from those you might need when you run a subshell. If you need to have the same commands run regardless of whether it is a login shell or a subshell, you can just use the source command from within .bash_profile to execute .bashrc. If .bashrc doesnt exist then no commands are executed when you start up a subshell. Cameron Newham. Learning the bash Shell (In a Nutshell (O'Reilly)) (pp. 89-90). O'Reilly Media. Kindle Edition. >On Wed, 21 Apr 2021 20:36:36 -0500, Daniel L Newhouse ><[email protected]> wrote: > >A file must have copy and delete enabled for the move command to work >on it. > >>On Wed, 21 Apr 2021 20:04:17 -0500, Daniel L Newhouse >><[email protected]> wrote: >> >> >>ls -al is the way to view files in Unix. That way you can see your >>startup scripts and the write permissions on your files. Change the >>write permissions with chmod. >> >> >>>On Tue, 20 Apr 2021 12:52:34 -0500, Daniel L Newhouse >>><[email protected]> wrote: >>> >>>There is a web site on all the prompt strings >>> >>>https://idojo.co/how-to-set-a-custom-bash-shell-prompt-string-ps0-ps1-ps2-ps3-ps4-in-linux/ >>> >>>PS1 The value of this parameter is expanded (see PROMPTING >>>below) >>> and used as the primary prompt string. The default value is >>> ``\s-\v\$ ''. >>>PS2 The value of this parameter is expanded as with PS1 and used >>>as >>> the secondary prompt string. The default is ``> ''. >>>PS3 The value of this parameter is used as the prompt for the >>>select >>> command (see SHELL GRAMMAR above). >>>PS4 The value of this parameter is expanded as with PS1 and >>>the >>> value is printed before each command bash displays during an >>>ex- >>> ecution trace. The first character of the expanded value of >>>PS4 >>> is replicated multiple times, as necessary, to indicate >>>multiple >>> levels of indirection. The default is ``+ ''. >>> >>> >>>>On Mon, 19 Apr 2021 10:02:42 -0500, Daniel L Newhouse >>>><[email protected]> wrote: >>>> >>>> >>>>.profile is the login script. >>>> >>>>PS1 is called a "prompt string." >>>> >>>>>On Sat, 17 Apr 2021 23:48:43 -0500, Daniel L Newhouse >>>>><[email protected]> wrote: >>>>> >>>>>.bashrc in the home directory is the startup script. >>>>> >>>>>>On Sun, 28 Mar 2021 19:52:47 -0500, Daniel L Newhouse >>>>>><[email protected]> wrote: >>>>>> >>>>>>"\s-\v\w$" is the best it will ever be, a $ before the prompt. >>>>>> >>>>>> >>>>>>>On Sun, 28 Mar 2021 18:40:31 -0500, Daniel L Newhouse >>>>>>><[email protected]> wrote: >>>>>>> >>>>>>>The fact that there is no startup script, however, means that you have >>>>>>>to change PS1 every time you restart cygwin! >>>>>>> >>>>>>>I also vote for Minix compatibility. >>>>>>> >>>>>>>>On Sun, 28 Mar 2021 18:35:48 -0500, Daniel L Newhouse >>>>>>>><[email protected]> wrote: >>>>>>>> >>>>>>>>>K, the syntax is "\s-\v\w". What I posted was a typo. Parts of these >>>>>>>>>Kindle books aren't searchable. Try searching on "PS1" to find it in >>>>>>>>>Bash from O'Reilly. >>>>>>>> >>>>>>>> >>>>>>>>Also, IIRC, ending the prompt with a '~' indicates a working >>>>>>>>directory, which is normal, whereas ending it with a '$' indicates an >>>>>>>>absolute path.