!! Bash

%%prettify 
{{{
#!/bin/bash                                                                     

pathname=/home/username/foo.txt
dir=${pathname%/*}
file=${pathname##*/}

echo -e "dir:$dir"
echo -e "file:$file"
}}}
/%

----
[Linux.Shell | CategoryComputing.Linux.Shell] - [Mac.Shell | CategoryComputing.Mac.Shell]