#!/bin/bash
a="/home/fredric/daily/journal.txt"
echo "basename of /home/fredric/daily/journal.txt = `basename $a`"
echo "dirname of /home/fredric/daily/journal.txt = `dirname $a`"
echo
echo "My own home is `basename ~/`"
echo "The home of my home is `dirname ~/`"
程序输出如下,
1.png