简体   繁体   中英

Custom commands path error in bash

I tried to make some bash custom commands in ubuntu 12.04, so i used mkdir bin to make a personal bin in my home directory and nano test to add the file and put this bash script in:

#!/bash/bin echo "totally works"

And then chmod 775 test .

So here is where the problem comes in, whenever I do test , there is no error and no output. But when i do ./test , it returns totally works . I checked .profile and the script said:

# set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi

And please don't say i didn't log-out and log back in, because i did. And still, same thing, no error and no output when i do test .

I also tried checking the $PATH with echo $PATH , and I got this:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

So I am stumped on this one, please and thank you for any help at all.

your hashbang line is incorrect

#!/bin/bash

or

#!/usr/bin/env bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM