On Thu, May 14, 2009 at 9:21 AM, Andrew Farnsworth <farn...@gmail.com> wrote: > By default, .bash_history is not set executable nor does it have the > necessary #! line at the beginning of it, therefore this won't work. My > method of calling bash and passing it your .bash_history file as a parameter > means it will try to execute it as a shell script which will work and cause > issues. Now if it does not update until you log out, then run "/bin/bash > ~/.bash_history", then logout, then login again and run it again... now you > are in an infinite loop.
Hey Andy, this is not quite so. The period operator in bash does not execute shell scripts, but rather is a synonym for source and sourcing your bash_history is functionally identical to sourcing it inside a running shell. No executable bit or shebang necessary. From the bash manpage: . filename [arguments] source filename [arguments] Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read. Cheers, -- Brandon D. Valentine http://www.brandonvalentine.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to nlug-talk@googlegroups.com To unsubscribe from this group, send email to nlug-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en -~----------~----~----~----~------~----~------~--~---