C***@thekyel.com
2014-12-22 18:09:54 UTC
I've got a weird issue where running a script with "run-shell" acts differently than running it from my actual shell.
If, however, I run the script using my key-binding above, I get an error on line 4.
The paste-buffer will paste, but the lock-file is never removed.
One weird thing I've figured out, is that if I remove the while-loop on lines 5-8, the script works no matter how I call it.
Any other thoughts/ideas on how to troubleshoot or debug this?
-- Kyel
bind-key -n "M-B" run-shell "/bin/bash /usr/bin/test.sh"
#!/bin/bash
lockfile="/tmp/.tmux.lock"
touch "${lockfile}"
tmux choose-buffer "paste-buffer -b '%%' ; run-shell \"rm ${lockfile}\""
while [ -f "${lockfile}" ]
do
sleep 1
done
touch "/tmp/.paste.done"
If I run the script from my shell, it works fine. The lock-file gets created, and then removed. The "/tmp/.paste.done" file is also created.#!/bin/bash
lockfile="/tmp/.tmux.lock"
touch "${lockfile}"
tmux choose-buffer "paste-buffer -b '%%' ; run-shell \"rm ${lockfile}\""
while [ -f "${lockfile}" ]
do
sleep 1
done
touch "/tmp/.paste.done"
If, however, I run the script using my key-binding above, I get an error on line 4.
The paste-buffer will paste, but the lock-file is never removed.
One weird thing I've figured out, is that if I remove the while-loop on lines 5-8, the script works no matter how I call it.
Any other thoughts/ideas on how to troubleshoot or debug this?
-- Kyel