-1

for our web application we use useful commands such as :

php artiasn
php artisan serve
composer update
php artisan view:clear

and now i want to make alias for them into ~/.bash_profile

alias ps ="php artisan"
alias serve="php artisan serve"
alias cu="composer update"
alias vc="php artisan view:clear"

now when i try to reload the file by using source ~/.bash_profile i get this error:

.bash_profile:1: php artisan not found

I thought i should use cd for change to the directory before. I got the error again. for example:

alias ps ="cd /User/myname/Desktop/project php artisan"
DolDurma
  • 11,830
  • 29
  • 129
  • 273
  • @DᴀʀᴛʜVᴀᴅᴇʀ you right, after successfully reload the file. when i try to use alias commands i get `zsh: command not found: vc` error – DolDurma Jan 17 '21 at 05:27

1 Answers1

0

If i remember correctly in the docs the space in between:

alias ps =

Should be:

alias ps=

Also instead of using source there is a shorter way with . ~/.zshrc

Per memory you have to reference where you have PHP. You can run which php to get the location if you cannot access from /usr/bin/php.

Can also try alias ps ="/usr/bin/php artisan"

DᴀʀᴛʜVᴀᴅᴇʀ
  • 4,253
  • 12
  • 46
  • 84
  • putting aliases into `~/.zshrc` file and reload it, resolved my problem. please update your post and let me to accept that – DolDurma Jan 17 '21 at 05:35
  • 1
    It might be better to use `#!/usr/bin/env php` rather than pointing to `/usr/bin/php` directly, depending on your needs. See https://stackoverflow.com/a/2429517/802469 – Reed Jan 17 '21 at 05:53