I just copy possible implementation of pbcopy and pbpaste for Linux from #1854092. That issue has more examples of similar commands for PowerShell, etc
```
#!/bin/sh
# print data from clipboard to stdout, again and again...
MODE="xclip"
#MODE="xsel" # doesn't work well, clipboard is not cleaned and the same text is printed again and again :-(
pbcopy ()
{
if [ "$MODE" = "xclip" ]; then
xclip -selection clip -i
else
xsel --clipboard --input
fi
}
pbpaste ()
{
if [ "$MODE" = "xclip" ]; then
xclip -selection clip -o
else
xsel --clipboard --output
fi
}
# MAIN
pbcopy </dev/null # clear clipboard
while :; do
TXT="$(pbpaste)"
if [ -n "$TXT" ]; then
echo "$TXT"
pbcopy </dev/null # clear clipboard
else
sleep 0.1 # sleep 100ms
fi
done
```
I just copy possible implementation of pbcopy and pbpaste for Linux from #1854092. That issue has more examples of similar commands for PowerShell, etc
```
#!/bin/sh
# print data from clipboard to stdout, again and again...
MODE="xclip"
#MODE="xsel" # doesn't work well, clipboard is not cleaned and the same text is printed again and again :-(
pbcopy ()
{
if [ "$MODE" = "xclip" ]; then
xclip -selection clip -i
else
xsel --clipboard --input
fi
}
pbpaste ()
{
if [ "$MODE" = "xclip" ]; then
xclip -selection clip -o
else
xsel --clipboard --output
fi
}
# MAIN
pbcopy </dev/null # clear clipboard
while :; do
TXT="$(pbpaste)"
if [ -n "$TXT" ]; then
echo "$TXT"
pbcopy </dev/null # clear clipboard
else
sleep 0.1 # sleep 100ms
fi
done
```