You are not logged in.

#1 2010-02-04 17:08:23

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Bash: push a string on input

I want to try to put a file manager in PROMPT_COMMAND, where e.g. you choose some files, press F6, and the top-level, interactive prompt then shows

$PS1 mv \
/tmp/file1 \
/tmp/file2 (space)

Kind of like read -e -i "ls "; eval $REPLY

So far I thought of two solutions:

xsel -x
echo -n "$filemanager_output" | xsel -i
xdotool key --clearmodifiers Shift+Insert
xsel -x

This may paste things out of the window (if you're quick)
(+edit) It won't work if the mouse isn't on the window.

And using screen:

echo -n "$filemanager_output" > /tmp/filemanager_output
(screen escape) readreg a /tmp/filemanager_output
(screen escape) paste a

But then screen is a requirement.

I couldn't find a bash built-in or readline command to do this, maybe I missed it?

What do you think of the above solutions? Too "hackish"?

Last edited by Procyon (2010-02-04 17:36:19)

Offline

Board footer

Powered by FluxBB