Hello. I am new to perl and have been trying to write a script that will ease the tention of mounting a windows share from my linux box. I also wrote this script because since you give the password as an argument to the mount command it is echoed in plain text on the console. Therefore, I came up with this, what is in it's present state, useless script. The error I get when I try to use it is "Could not resolve mount point /mnt/win", where /mnt/win is obviously the mount point. When I use the command on the console all is well. Anyway, here is the code. Any help at all will be very helpful, me being the newb that I am.
#!/usr/bin/perl
print "Enter the hostname of the computer: ";
$hostname = <stdin>;
print "Enter the sharname you wish to mount: ";
$share = <stdin>;
print "Enter a valid username: ";
$username = <stdin>;
print "Enter the password:";
system "stty -echo";
$password = <stdin>;
system "stty echo";
print "\nSpecify a mount point?: ";
$mntpoint = <stdin>;
$options = "username=$username,password=$password";
system("mount", "-t", "smbfs", "-o", "$options", "//$hostname/$share",
+ "$mntpoint");
20030505 Edit by Corion: Changed formatting to use code tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.