linux - 我正在尝试更改文件名,但脚本给了我错误

标签 linux bash shell unix scripting

#!/usr/bin/env bash 
touch etc/skel/.abc
cat << EOF > etc/skel/.abc
test -f .profile && source .profile

    if [ -f "etc/skel/.runonce" ]
        then
        source etc/skel/.runonce
        mv "etc/skel/.runonce" "etc/skel/.ranonce"
    else
        echo ".runoce doesn't exist"

    fi 

最佳答案

除非您从根目录(或开头的 cd/)执行此操作,否则在任何地方的 etc 之前都需要有一个 /

关于linux - 我正在尝试更改文件名,但脚本给了我错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52910211/

相关文章:

linux - Unix:ls -t 的时间分辨率是多少?

mysql - bash脚本中的特殊字符

linux - 进入 zsh 并从 bash 脚本执行命令

c - 如何正确创建和使用makefile

linux - 以编程方式禁用 CPU 内核

Linux Shell 脚本 : Storing the output of a command line program

c - linux clone() 返回 -1 作为 child_pid

linux - VirtualBox 设备上没有足够的剩余空间

bash 错误 : Integer expression expected

shell 脚本停止工作 --- 需要重写吗?