I have to, a lot of times, get things onto the clipboard from the terminal. I do it like this:
echo "something"|xclip -selection clipboard
Doing this every time is way too lame, and I want to make a shortcut. How do I do it?
I have to, a lot of times, get things onto the clipboard from the terminal. I do it like this:
echo "something"|xclip -selection clipboard
Doing this every time is way too lame, and I want to make a shortcut. How do I do it?
You could define a function:
clip() {
echo "$@" | xclip -selection clipboard
}
add it to your initialization script (~/.bashrc), then use it:
clip something
clip "one two"
You could use alias.
Add below line to ~/.bash_aliases
.
alias my_alias_name="xclip -selection clipboard"
Then you go like this:
echo "something" | my_alias_name
You have to come up with good name for that on your own.
Answering your comment:
...the little script i could make is named cpstring and I go cpstring "anything". Is there a way to do this with bash scripting?
Create cpstring file, put it somewhere visible by your $PATH:
#!/bin/bash
echo "$@" | xclip -selection clipboard
Remember to add exe rights to that file: chmod +x cpstring