SHELL编程:写一首情诗,送给亲爱的你
内容:
复制代码代码示例:
#!/bin/sh
mkdir -p /where/ever/you location=/where/ever/you [ "${location:0:1}" = "/" ] || location=$PWD/$location while [ -e $location ] do cd ${location%/*} echo "I love you!" done
注释:
复制代码代码示例:
#!/bin/bash
# 可人儿啊,请告知你的位置 location=/where/ever/you # 无论如何艰辛,我都会寻找你的坐标 [ "${location0:1}" = "/" ] || location=$PWD/$location # [注一] # 假如你是存在的... while [ -e $location ] do # 让我与你在一起 cd ${location%/*} # [注二] # 让我跟你说声---我爱你﹗ echo "I love you!" done
注1:
注2: |