SHELL Command -- get path and file name: dirname basename to get a file storage path, you can use dirname. There are two scenarios: 1. Full path, for example, aguo @ auto-test: ~> Dirname/home/aguo/insert. SQL/home/aguo # obtain the directory where the file is located. 2. Only file names are available. For example: aguo @ auto-test: ~> Dirname Environment. indicates that the path is to get a file name in the current directory (remove the suffix). You can use basename. This command seems a little rigid to use. You need to write the complete suffix. Example: aguo @ auto-test: ~> Basename insert. test. SQL test insert. test. SQL aguo @ auto-test: ~> Basename insert. test. SQL insert. test. Of course, dirname and basename have cool Replacement Methods for pure shell. Dirname: aguo @ auto-test: ~> A =/home/aguo/insert. SQL aguo @ auto-test: ~> Echo $ {a %/*}/home/aguo basename: aguo @ auto-test: ~> A = insert. test. SQL aguo @ auto-test: ~> Echo $ {a %. *} insert complex a =/home/aguo/insert. test. SQL # Only Extract files without paths and. A =$ {a %. *} & a =$ {a ### */} & echo $