Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8109565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:27:46+00:00 2026-06-06T01:27:46+00:00

In .mailrc , I would like to get the first row, but I get

  • 0

In .mailrc, I would like to get the first row, but I get the second row

alias UIF "UIF Boxning <uifboxning@boxing.se>" # cool (written manually by me)
alias test_alias test_name <test_mail> # no quotation marks (written by below defun)

I am unsure if the problem is with format or echo. Have a look:

(defun save-mail-address (address name alias)
  "add an alias to the .mailrc file"
  (interactive "sMail address: \nsFull name: \nsAlias: ")
  (let ((compl-alias (format "alias %s \"%s \<%s\>\"" alias name address)))
    (shell-command (concat "echo " compl-alias " >> .mailrc")) ))
(defalias 'sma 'save-mail-address)

Edit:

OK, the goal is keep it like this:

alias long      "Long Long <long@long.long>"                    # 123456
alias s         "S S <s@s.s>"                                   # 1

Also, made I check so not to include duplicates:

(defun append-blanks (str len)
  (concat str (make-string (- len (length str)) ? )) )


(defun save-mail-address (mail name alias phone)
"add an alias to the .mailrc file"
(interactive "sMail mail: \nsFull name: \nsAlias: \nnPhone: ")
  (let*(
    (alias-alias (format "alias %s" alias))
    (alias-alias-blanks (append-blanks alias-alias 16))
    (mail-str (append-blanks (format "\"%s \<%s\>\"" name mail) 48))
    (line (format "%s%s\# %d\n" alias-alias-blanks mail-str phone))
    (file "~/.mailrc") )
      (with-temp-buffer
        (insert-file file)
        (if
          (search-forward alias-alias (point-max) t) ; t = return nil on fail
            (message (format "Error: The alias %s is already in use." alias))
            (progn
              (insert line)
              (sort-columns nil (point-min) (point-max)) ; nil = not reversed
              (write-file file nil) ))))) ; nil = inhibit confirm
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:27:48+00:00Added an answer on June 6, 2026 at 1:27 am

    You need to ensure that variable arguments passed to a shell command are always appropriately escaped.

    (shell-command (concat "echo " (shell-quote-argument compl-alias)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following code to get through each of values foreach (array('facebook', 'twitter',
Hi I have a div box that opens on my page and then loads
I have a very simple contact form on my site, Im looking for users
I'm using a crontab to run a maintenance script for my minecraft server. Most
I am processing items users have selected from a gridview, and performing an email
Hell Guys! I have used SMTP server to send mail as per below public
When I sent a mail using System.Net.Mail, it seems that the messages do not
Hi I am still learning Jquery and have a problem accessing form elements. My
When sending an email from C# with body being large is resulting in failure
I am wondering about how i can to check if the email has been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.