TCL Reading file from Server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting TCL Reading file from Server
# 1  
Old 05-05-2009
TCL Reading file from Server

I'm nearly finished developing my app, im programming it in tcl/tk. I just need to get 1 last thing done. When my app starts, i ask the user for username and password. These are stored on a file on a unix server.

My problem is how do i read a file from a unix server, i've tried everything but there doesnt seem to be a way to read a file from unix server in tcl/tk. I'm nearly at the conclusion that it cant be done.

Can anyone help me on this?

Thanks,
Phil.
# 2  
Old 05-05-2009
Hi-

By now, you may have already figured out the solution to your problem. If so, post your results. If not I have the following questions:

Is your script not already on the Unix server and are you trying to read from a remote or local file? I assume you mean reading from a local file that resides on the same server your script resides. There is more than one way to ready from a file in tcl. Here is one:

<snip>
set notefile [file join $env(HOME) {.notes}]
set f [open $notefile r]
puts [read -nonewline $f]
<snip>

1. Set the location to the file ".notes". This will is located in the home folder.
2. "f" is a file handle that can be used to read the content of the file ".notes".
3. output the content of ".notes" to stdout

I hope this helps you or anyone else who might have this same problem.


-deftguru
# 3  
Old 05-05-2009
Ok, let me explain my application in more detail.

My application is running on windows, im using an ssh connection to unix. So i have a procedure set up to do the ssh, and i need within that procedure to read the file from the unix server.
I'm open to anyways of doing this, even if its easier to have a unix script on the server do it, and then within the ssh connection i can run the script.
# 4  
Old 05-07-2009
I really dont want to be bumping my post, as i know mod will kill me :P

But seriously does anyone know anyway of reading a file from windows to unix in tcl/tk.

I really need to do this....

Please respond.

Thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to call tcl function from other file !!

Hi, Can a function written in tcl in some other file be called in unix scripts ? Like this ? This is my code now--- shell.sh: #!/bin/bash tclsh snmpv2-conf-sam.tcl $SERVER $NODESYSIP $SPASSWD but i need this in a different way like , without having a .tcl file i want the... (2 Replies)
Discussion started by: giri_luck
2 Replies

2. Programming

File handling in TCL

Hi, I have n number of files in a directory with extension .PGM i need to store the full path name in a variable and only the file name with extension in another variable. Each time i'll be using the next file name for manipulation. Please help me out to do this using TCL thanks (1 Reply)
Discussion started by: Syed Imran
1 Replies

3. Programming

TCL reading file

This is the code i have to read and display each line every time. please let me know the bug in this.. am not getting the output set fp set file_data close $fp set data foreach line $data { puts $data } content of abc.txt is ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

4. UNIX for Advanced & Expert Users

File Format in TCL

Hi, Can anyone please guide me in writing a TCL script. I want to have a procedure to recreate an existing file and backup its copy and rename it by time of the updates are made. Eg: I have file xyz.tcl (which on recreation is saved as xyz_11jan_15_30_11.tcl) So when I do % ls... (1 Reply)
Discussion started by: mail2leo
1 Replies

5. Solaris

TCL/Expect Reset Server and Load Solaris

Hello! I'm having issues getting Solaris to install on a T2000 using an expect script. The jumpstart server works fine to manually issue the commands and we have done many installs this way. I'm lazy and want to reset the OBP password, install Solaris, log in after install, and run some other... (4 Replies)
Discussion started by: skitch
4 Replies

6. Programming

Parsing a text file in Tcl

Hi all, I need to parse through a text file searching for a specific string, then after I find this string read in remaining data off the line to a variable. I've tried various things and can't seem to get any to work. Any help would be much appreciated. (2 Replies)
Discussion started by: caboose57
2 Replies

7. Shell Programming and Scripting

Reading File from Server - perl

Hey, I'm trying to read a file from a server. Simple file with some numbers. Here is the code i'm running. use Net::SSH::Perl::SSH1 ; $scon = Net::SSH::Perl->new ("com123.sever.mydomain.com",(protocol=>'2',port=>'22',debug=>'true')); $scon->login("user123","pass123"); open(FILE,... (9 Replies)
Discussion started by: Phi01
9 Replies

8. UNIX for Dummies Questions & Answers

Reading line from file - TCL

I Have output of ps -ef in file. while reading from file, it reads one word but i want to read the full line. Is there any way to set IFS in TCL as we set in Shell. Thanks Ajay Kumar (2 Replies)
Discussion started by: aju_kup
2 Replies

9. Shell Programming and Scripting

File Handler in TCL

Hai , I Have Some x.txt file in which has the following data x.txt HI, How Are u r u fine /home/Sanju/samp.html /root/Sanju/design/sample now in tcl i have the following script set fp while { >= 0 } { puts $line ... (1 Reply)
Discussion started by: sanjustudy
1 Replies

10. Shell Programming and Scripting

Reading response from server

I am trying to write a korn shell script which posts commands to a server and read the response back from the server. Any idea how I can read the servers response? I have tried doing the following: ( LOGIN:xxxxx command to server read ANSWER echo $ANSWER >file1... (4 Replies)
Discussion started by: frustrated1
4 Replies
Login or Register to Ask a Question