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

  • Home
  • SEARCH
  • 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 6606199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:22:14+00:00 2026-05-25T19:22:14+00:00

As a sysadmin I routinely rdp and ssh into remote machines for administration. I’ve

  • 0

As a sysadmin I routinely rdp and ssh into remote machines for administration.

I’ve created a file, ${SERVER_FILE}, containing one entry per line noting the hostname and protocol to use when connecting to a given server.

Example:

...
server1,ssh
winsrv,rdp
...

Given the above entries I want the following to be created+evaluated (rdp is itself a script on my system):

alias server1='ssh server1' winsrv='rdp winsrv'

The following code, when I cut and paste the resultant output to an alias command, works flawlessly:

$ echo $(sed "s/\(.*\),\(rdp\|ssh\)/\1='\2 \1' /g" ${SERVER_FILE} | tr -d '\n')
server1='ssh server1' winsrv='rdp winsrv'

$ alias server1='ssh server1' winsrv='rdp winsrv'

$ alias
alias server1='ssh server1'
alias winsrv='rdp winsrv'

SO I change it to this to actually cause the aliases to be created and I get errors:

$ alias $(sed "s/\(.*\),\(rdp\|ssh\)/\1='\2 \1' /g" ${SERVER_FILE} | tr -d '\n')
bash: alias: server1': not found
bash: alias: winsrv': not found

$ alias 
alias server1=''\''ssh'
alias winsrv=''\''rdp'

Advice?

  • 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-05-25T19:22:14+00:00Added an answer on May 25, 2026 at 7:22 pm

    Try:

     $ eval alias $(sed "s/\(.*\),\(rdp\|ssh\)/\1='\2 \1' /g" ${SERVER_FILE} | tr -d '\n')
    

    Works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A sysadmin teacher told me one day that I should learn to use make
I have created a test user that has sysadmin right in SQL Server 2005
How to insert a line into a file using sed before a pattern and
Our sysadmin renamed several of our AD groups that we are using in SQL
I'm by no means a sysadmin so please correct me if I'm wrong. I
My account is in the securityadmin role and I cannot grant myself sysadmin permission.
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Python for Unix and Linux System Administration is aimed at sysadmins. Any other favorites
While I do understand php, I'm more of a sysadmin than a programmer. Add
I need to export the results of a query to a csv file and

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.