You ought to wrap that in a script.
Code:
#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
set -e
p=sms
test -e /tmp/${p} || mkdir -p /tmp/${p}
test -d /tmp/${p}
dst=$(mktemp -p ${p} -d sourcefile_XXXXXX)
src=somesourcefile
cp -p ${src} ${dst}
As a one-liner it would still be using
command substitution.
Code:
cp -p somesourcefile $(mktemp -p sms -d sourcefile_XXXXXX)
The way you have it set, the directory /tmp/sms/ must exist before running
mktemp because
mktemp won't create it for you.