mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Script to run command in terminal (OS X)
This commit is contained in:
parent
071e6cdb44
commit
014addb675
1 changed files with 24 additions and 0 deletions
24
scripts/terminal.sh
Executable file
24
scripts/terminal.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Execute command in terminal emulator Mac OS X
|
||||
|
||||
# Path to temporary script file
|
||||
SCRIPT_FILE=/var/tmp/doublecmd-$(date +%s)
|
||||
|
||||
# Add shebang
|
||||
echo "#!/usr/bin/env bash" > $SCRIPT_FILE
|
||||
|
||||
# Remove temporary script file at exit
|
||||
echo "trap 'rm -f $SCRIPT_FILE' INT TERM EXIT" >> $SCRIPT_FILE
|
||||
|
||||
# Change to directory
|
||||
echo "cd $(pwd)" >> $SCRIPT_FILE
|
||||
|
||||
# Copy over target command line
|
||||
echo "$@" >> $SCRIPT_FILE
|
||||
|
||||
# Make executable
|
||||
chmod +x "$SCRIPT_FILE"
|
||||
|
||||
# Execute in terminal
|
||||
open -b com.apple.terminal "$SCRIPT_FILE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue