Tag Info

New answers tagged

0

bash does read ~/.bashrc though even when non-interactive when invoked over ssh (a misfeature IMO, but would come handy to you here). So you could add to the top of ~/.bashrc on the remote host: if [ -n "$SSH_CLIENT" ] && [ "$SHLVL" = 0 ] && [ -n "${-##*[il]*}" ]; then . /etc/profile . ~/.bash_profile fi


1

Create a wrapper shell function sshc which prefixes the source ~/.bash_profile boiler plate for you: function sshc { local host=$1 local cmd=$2 ssh $host "source ~/.bash_profile && $cmd" } You can then use this as: $ sshc localhost 'which perl' /home/calid/perl5/perlbrew/perls/perl-5.20.1/bin/perl


0

Ok, so I've figured out how I can do this with Gary Johnson's help on the Google Groups vim_use group. He helped by stating how to run the tput commands from vim. Here is my final solution: Have the following function script in vim memory: function! ShowTerm() call system(">/dev/tty tput rmcup") call input("") call system(">/dev/tty ...


1

Starting gvim opens a new window, so the terminal window stays available for commands. For intermediate "shell escapes" I do :sh to get access to a shell session, and type <Ctrl>-D to exit it; no fg is needed, but a prompt is added in this case to the console shell. And with no X running I start two consoles, one where vim is running, and the other ...


0

Does the Vim command :shell work as you want? :shell<return> causes Vim to run your $SHELL. When you exit the shell, you're back in Vim, right where you left off.


0

If you have ruby installed, you can use aka to generate permanent alias on the fly.


1

dhag explained why $PATH appears to be correct, even though it isn't. The reason the path doesn't get changed is most likely that su doesn't run the shell interactively, meaning that either bash.bashrc doesn't get executed in the first place, or that it quits before doing anything because it detects that it's not running interactively. You'll either have ...


2

When you run sudo su -l -c "echo $PATH", $PATH is expanded in your original shell, because the double quotes do not prevent this expansion. You want sudo su -l -c 'echo $PATH' to expand in the su shell instead. I assume a follow-up question will be "then how do I get java to run"? I would suggest either calling java with its full path, or, and this may or ...


0

There already is a very similar question with a good accepted answer: How can I detect if the shell is controlled from SSH? You can either check if one of the bash variables SSH_CLIENT or SSH_TTY is set by checking if their length is not zero: if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then # do your stuff here fi Alternatively you can check if ...



Top 50 recent answers are included