Tag Info

New answers tagged

2

zsh Add this to .zshrc: pycalc() { python -c "print $@" } alias p=pycalc In your Z shell, use it like this: $ p 12+12 24 $ p "12*12" 144 Notice you need the double quotes when the statement contains a globbing character such as the asterisk. Or, you could turn off globbing for that alias: pycalc() { python -c "print $@" } alias p='noglob ...


0

Bash Add the following to .bashrc pycalc() { python -c "print \"%f\" % float($@)" } alias p=pycalc You can append it with the echo command. One-line: echo -e 'pycalc() {\n python -c \"print \\\"%f\\\" % float($@)\"\n}\nalias p=pycalc' >> .bashrc Multi-line: echo -e 'pycalc() { python -c \"print \\\"%f\\\" % float($@)\" } alias p=pycalc' ...


0

Did you open a new terminal window or run source ~/.bashrc after editing? The current terminal needs to be updated for the paths/aliases. $ vim ~/.bashrc alias prj='cd ~' :x $ alias $ alias rvm-restart='rvm_reload_flag=1 source '\''/Users/dx072/.rvm/scripts/rvm'\''' $ source ~/.bashrc $ alias $ alias prj='cd ~' alias rvm-restart='rvm_reload_flag=1 source ...


1

Usually, bash only sources your ~/.bashrc startup script file for interactive, non-login shells. Usually, bash only sources your ~/.profile startup script file for interactive login shells. Usually, Terminal.app treats new terminal windows as interactive login shells. So in normal circumstances, only your ~/.profile gets read and executed; your ~/.bashrc ...



Top 50 recent answers are included