I'm trying to figure out what words does the -i
nteractive option of cp
accepts as input.
For your convenience, here's code that sets up files for experimentation.
touch example_file{1..3}
mkdir example_dir
cp example_file? example_dir
cp -i example_file? example_dir
Run Code Online (Sandbox Code Playgroud)
The shell then asks interactively for each file whether it should be overwritten. It seems to accept all sorts of random input.
cp: overwrite 'example_dir/example_file1'? q
cp: overwrite 'example_dir/example_file2'? w
cp: overwrite 'example_dir/example_file3'? e
Run Code Online (Sandbox Code Playgroud)
I tried looking into the source code …
这是巴什。这种行为在鱼类中是相似的。
$ which python
/usr/bin/python
$ alias py=python
$ type py
py is aliased to `python'
Run Code Online (Sandbox Code Playgroud)
?然后,运行type -P py
什么也不打印,正如我所期望的那样以/usr/bin/pyton
与下面看到的类似的方式打印。?
$ type ls
ls is aliased to `ls --color=auto'
$ type -P ls
/bin/ls
Run Code Online (Sandbox Code Playgroud)
该-P
选项的文档读取
-P force a PATH search for each NAME, even if it is an alias,
builtin, or function, and returns the name of the disk file
that would be executed
Run Code Online (Sandbox Code Playgroud)
我已经确认/usr/bin
(所在的目录python
)在PATH
.
这里发生了什么?