Score:0

Whats the command line for copy and paste in termimal?

pw flag

So here is what I am trying to do, questions will be at the end. I'm being very pedantic I know, but its a good learning experience and a good bit of fun.

I am creating a setup script, which includes all the repositories and apts/snap packages i will need for a fresh setup, along with some CHMOD/CHOWN settings.


So in my script file I can just use $USER e.g. /media/$USER/blah blah, that works. But, in my setup.desktop shortcut I need to use the actual username instead of $USER.

How can I run a script to; pull the current username, copy that user name, edit the .desktop file then paste the name into the EXEC= /media/USERNAME/ path?


To break down the questions as I know there are multiple in that one. How can I copy a text from terminal, WITHOUT using mouse or keyboard?

Is there a -[CRTL + C] entry I can type e.g. -x is execute in CHMOD, instead of using my keyboard to press the CTRL SHFT C key?

If so, what is both copy and paste?

OR is there an easier way to put the username into the shortcut file via a script?

Score:1
ca flag

So, replace "USERNAME" with "$USER"-content...

$ echo >TEMP.desktop "EXEC=/media/USERNAME/someexecfile"

$ sed -ire "s/USERNAME/$USER/" TEMP.desktop 

$ cat TEMP.desktop 
EXEC=/media/hannu/someexecfile

Related:
www.tldp.org > Bash guides - will tell a lot of detail about how to use Bash and write Bash scripts, already by skimming through them (there are two guides)

$ man sed will tell you details about sed in particular,
https://regex101.com/ - contains a test-bench for regular expressions.
https://www.regular-expressions.info/ - tutorials and examples on regex'es.


$ man xclip for setting / accessing actual clipboard data. note that a clipboard might be application-local, e.g. an application might not be using the X clipboard.

budryx avatar
pw flag
Absolute legend!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.