Re: view_attachment script query
- To: mutt-users@xxxxxxxx
- Subject: Re: view_attachment script query
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Sun, 9 Dec 2007 17:15:38 -0600
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date:from:to:subject:message-id:references:mime-version:content-type:in-reply-to; q=dns/txt; s=default; bh=wvpwqlUfk2dZJyQ/MUMvpP+sHDw=; b=XSqNpXJeJusBAGy0+oB72B1lnpRHooK8XkhZ1KYmSa7Ps/JaU/xMez40gVYh3iD6puhT17gW+tusjNN2/JrGazXZQJsgopGtVfFXT9HfIvU33bXb8m4nJEUtRW5SXC5oLcyL6W2/FJ/lmAmcsB2TK/X6PODCHlRVm0D8ZSiEId4=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=VwrIvJbDJ0WFAFjp7IJbydhR26HFBPeSI/x3xvuK/1vRemPgqWkVsN4WSYS72UmuaigjDFL/KfoS3FVVWLl5VVtIh4UYva7MvNfp0dlxlO8z9AdiyF7BOaT5ugPU4O3ypWCH+ZBAk0fUifAAMR8tdXuK47wgl3tHcddcj5A5FZw=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent;
- In-reply-to: <20071209231009.GB1866@xxxxxxxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- References: <20071209231009.GB1866@xxxxxxxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.17 (2007-12-07)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday, December 9 at 11:10 PM, quoth Jamie Griffin:
>Firstly, it's working and the attachments are oping succesfully.
>However, after i've closed it and return to mutt
>there's an error message on the command line which says:
>/usr/local/bin/view_attachment: line 122: [: too many arguments
Probably insufficient quoting somewhere.
>here is line the part of the script from line 122:
>
>if [ -z $open_with ]; then
There's your problem. That should be:
if [ -z "$open_with" ]; then
The reason is that if your open_with path has any spaces in it (which
"Microsoft Word" does), it will be treated as multiple arguments to
the test. What your really want is just to treat the whole thing as a
single string, and that's what surrounding it in double-quotes
ensures.
> open $newfile
>else
> open -a "$open_with" $newfile
>fi
>
>
>The fact it's working fine is good, of course, but this has bothered
>me. Does anyone know why this is? perhaps i should remove the
>argument?
The reason it's working fine is that when the test fails (because of
the incorrect quoting), all that happens is that the "else" portion is
triggered, which is what you wanted to happen in the first place
(since you're specifying an "open_with" argument).
~Kyle
- --
I know that there are people who do not love their fellow man, and I
hate people like that!
-- Tom Lehrer
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iD8DBQFHXHcaBkIOoMqOI14RAhroAJ9KGIk+gdvfUG4uAASzSMPiLrtdCgCgpEra
nrlC0Cu6JcA+gBX1hZloFGo=
=ywd+
-----END PGP SIGNATURE-----