Add new comment

Submitted by davek (registered user) on Tue, 2006-11-28 07:02.

I found that I had to make two changes to the script.  First, silly as it sounds, I have some shares with more than two spaces.  So I had to change the awk command "sub" to gsub.  Also, NT/XP insists on sharing some default shares with a "$" in them.  Unless the $ is escaped, autofs doesn't like the output of the script.  Here are my changes:

$SMBCLIENT $smbclientopts -gL $key 2>/dev/null \
   | awk -v key="$key" -v opts="$mountopts" -F'|' -- '
        BEGIN   { ORS=""; first=1 }
        /Disk/  { if (first) { print opts; first=0 };
                  gsub(/ /, "\\ ", $2);
                  sub(/\$/, "\\$", $2);
                  print " \\\n\t /" $2, "://" key "/" $2 }
        END     { if (!first) print "\n"; else exit 1 }
        '

Thank you so much for the script!  I wouldn't have figured this out without the example

Davek 

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.