Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我在作业中缺少的最后一部分是一种只打印文件名的方法(而不是./usr/etc/folder/directory/file.pdf,我想打印file.pdf)但我不能记住如何做到这一点。完成此任务的最佳/最短方法是什么?
basename
简单的答案:使用 /usr/bin/basename
由于使用 C Shell,正确的答案是使用字符串修饰符:t来获取文件名。
:t
例子set FILENAME = $PATH:t
set FILENAME = $PATH:t