Visit Our UNIX and Linux User Community


Copying a command/line to clipboard


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copying a command/line to clipboard
# 1  
Old 08-06-2011
Error Copying a command/line to clipboard

hi all,
i am newbie to Unix scripting..
I am writing a script which will have a line of commands, which needs to be copied to clipboard.
Any ideas welcome..

Usage::
I am using the script in this way, The script will have some lines (like below)
export TERM=xterm; cd test_env; TMOUT=0

after that i connect via ssh to a box, after loggin in, i should have the above lines in clipbozrd, so i can paste them right away and work, else is there a way to make those lines execute after ssh works. (I connect via ssh to various box each time, so i cant think of saving the contents to a file and executing/invoking it.

Please help
# 2  
Old 08-10-2011
Well, the shell on the far end has a file for startup, sometimes several (ksh has ~/.profile and ~/.kshrc, the first for login and the second for every ksh start).

It is hard to send some input into ssh and then turn the ssh stdin over to your terminal without introducing delay.

Some people run the ssh in command mode on a shell (no tty), and send a script to that shell to set environment like you desire, and then fire up a terminal, perhaps an xterm through an ssh tunnel to your xserver. So, you get a new terminal for your choice of shell running there, which you can leave up, minimized, one or more for each host. The script can run nohup in the background.

I am hyper, and run a whole Xvnc desktop on every server. That way, each host's desktop is preserved even if connections are lost or other hosts are rebooted. I can reconnect to each desktop with a vncviewer (I use ultravnc) session and, where security demands, an ssh tunnel.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #538
Difficulty: Medium
A programming language that requires you to declare a variable and its type is a non-statically typed language.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying characters on each line in a file

Hello, I would like to copy the first and third char on each line of a file and place them in the 14h and 17th char positions. The file name is listed first and is 6 char's and the dir name is second and also same char size on each line. The file has thousands of lines. Initial... (6 Replies)
Discussion started by: dmm
6 Replies

2. Solaris

Solaris 10 : command to copy text to the clipboard.

I'm searching a command to copy text to the clipboard. xclip and xsel are commands which are available on several kind Linux and Unix OS, but is unfortenuately not available on solaris 10. REF : xpt.sourceforge.net/techdocs/nix/x/general/xwin12-Xclipboard/single/ clipboard of openSolaris is... (9 Replies)
Discussion started by: droopy4u
9 Replies

3. UNIX for Dummies Questions & Answers

Clipboard retrieve/paste command

I mainly use Max/MSP for my audio programming, but today I am working on a project that requires the use of shell. Is it possible to do this? Retrieve the contents of the clipboard. Send a keystroke to an application without loosing focus, for example, I want to initiate a paste command (with... (0 Replies)
Discussion started by: fhill2
0 Replies

4. Shell Programming and Scripting

copying to the end of the line

Hi, I have a file as such 1 <text1><text2></ 2 <text3><text4></ 3 <text5><text6></ 4 <text7><text8></ I need is so the first bit of text in the line is at the end as its xml so 1 <text1><text2></text1> 2 <text3><text4></text3> 3 <text5><text6></text5> 4 ... (12 Replies)
Discussion started by: legolad
12 Replies

5. Shell Programming and Scripting

copying a line from a file using sed

Hi All, I need to copy a specific line from a file to another file. lets suppose the line number 13 of a file when I am writing the line number explicitly.. its working fine sed -n '13p' afile > anotherfile but, when inside a script, i am getting the line number value inside a variable... (4 Replies)
Discussion started by: gotamp
4 Replies

6. Shell Programming and Scripting

Copying a line from one file to other using vi editor

Hi Guys, the command ":yy" copies the line but it can be pasted in the same file. How can it be done if I want to copy it in other file. (2 Replies)
Discussion started by: ajincoep
2 Replies

7. Shell Programming and Scripting

Copying x words from end of line to specific location in same line

Hello all i know it is pretty hard one but you will manage it all after noticing and calculating i find a rhythm for the file i want to edit to copy the last 12 characters in line but the problem is to add after first 25 characters in same line in other way too copy the last 12 characters... (10 Replies)
Discussion started by: princesasa
10 Replies

8. Shell Programming and Scripting

copying from line N1 to line N2 of a file in a series of files

Dear community, I'm quite a newbie with scripting, I have this problem: I have a file with many lines and I want to copy the lines from 1 to N to file.1, from N+1 to 2N to file.2, and so on up to the end of the file I have tried with something like this (N=43 in this example): awk '{for... (2 Replies)
Discussion started by: paolalup
2 Replies

9. Shell Programming and Scripting

Copying/Extracting from line A to line B

Can any one please help me to copy file content between particualr line numbers. (3 Replies)
Discussion started by: engineer
3 Replies

Featured Tech Videos