17 lines
273 B
Bash
Executable File
17 lines
273 B
Bash
Executable File
#!/bin/sh
|
|
# trk — translate English↔Korean, direction picked from input.
|
|
|
|
if [ $# -gt 0 ]; then
|
|
text=$*
|
|
else
|
|
text=$(cat)
|
|
fi
|
|
|
|
if printf '%s' "$text" | grep -qP '[\x{AC00}-\x{D7A3}\x{3131}-\x{3163}]'; then
|
|
pair=ko:en
|
|
else
|
|
pair=en:ko
|
|
fi
|
|
|
|
exec trans -b "$pair" "$text"
|