我试图在/ etc/profile中添加echo语句,但它们会执行.
示例:这是我写的
echo CURRENTYEAR="`/bin/date +%y`" >> /etc/profile
echo CURRENTWEEK="`/bin/date +%V` " >> /etc/profile
echo VERSION="$CURRENTYEAR"."$CURRENTWEEK" >> /etc/profile
echo export VERSION >> /etc/profile
echo export SVN_HOME="https://example.com/svn/road" >> /etc/profile
echo SVN_BRANCH="$SVN_HOME/branches/qa_weekly/$VERSION" >> /etc/profile
echo export SVN_TAG="https://example.cpm/svn/road/tags" >> /etc/profile
echo export SVN_TRUNK="https://example.com/svn/empire/trunk" >> /etc/profile
export PATH=$PATH:/road >> /etc/profile
export SVN_BRANCH
Run Code Online (Sandbox Code Playgroud)
结果:我得到了什么
CURRENTYEAR=15
CURRENTWEEK=33
VERSION=.
export VERSION
export SVN_HOME=https://example.com/svn/road
SVN_BRANCH=/branches/qa_weekly/
export SVN_TAG=https://example.com/svn/road/tags
export SVN_TRUNK=https://example.com/svn/road/trunk
Run Code Online (Sandbox Code Playgroud)
我希望它在/ etc/profile中如下所示
CURRENTYEAR=`/bin/date +%y`
CURRENTWEEK=`/bin/date +%V`
VERSION=$CURRENTYEAR"."$CURRENTWEEK
export VERSION
SVN_BRANCH=$SVN_HOME/branches/qa_weekly/$VERSION
SVN_TAG=$SVN_HOME/tags
SVN_TRUNK=$SVN_HOME/trunk
Run Code Online (Sandbox Code Playgroud)
提前致谢.