Home > OS >  Centos7.6 above $0 is unable to realize the command itself
Centos7.6 above $0 is unable to realize the command itself

Time:09-29

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
  • Related