Are there any other solutions?
After centos7.5
# echo $0
- bash
Do the following after the script directly tip can't find the directory,
This parameter is not correct, on Ubuntu is normal
Echo $0
Bash
Script:
#!/bin/bash
Work_path=$(CD ` dirname $0 `; The PWD)
CD $work_path
The PWD
Execution:
$sh/home/1. Sh
/home/vm