On Thu, 23 Jan 2014, Todd Maurice wrote:

1.
I would like to set d-i preseed/late_command in such way that a line
containing alias instructions would get added to ~/.bashrc. That way alias
would be active when I first login after the installation (typing 'myalias'
would start script1).


I tried
d-i preseed/late_command string in-target echo "alias myalias='sh
./script1'" >> /home/user/.bashrc

but it failed with "Exit code 1"


I tried
d-i preseed/late_command string in-target sed -i '1i alias myalias='sh
./script1'' /home/user/.bashrc

but it failed with "Exit code 2"

I suspect that one of the attempts failed due some sort of syntax error.


Unless your username is "user", it looks like you're going to have a problem writing to a file in a non-existent directory. On the whole I think you'd be better off hand-editing $HOME/.bashrc in your favorite text editor. It's only one line of code and you get to verify that it was entered correctly.

I'm not a bash user (ksh has long been my usual shell), but the line will look something like:

alias myalias="sh ./script1"

2.
Is there a way to make that alias run automatically when the user logs in?
With "run automatically" I mean that alias would execute script1 as soon as
the user logs on without requiring the user to type 'myalias'.

You simply invoke the script in your $HOME/.profile, like so:

#We can't assume the script is in the current directory
#The source command executes the commands contained in the script without #spawning a new process
source $HOME/script1



--------------------------|
John L. Ries              |
Salford Systems           |
Phone: (619)543-8880 x107 |
or     (435)867-8885      |
--------------------------|




--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/alpine.LSU.2.11.1401231103120.12032@falcor.salford.riesenhaus.local

Reply via email to