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 7613035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:04:16+00:00 2026-05-31T02:04:16+00:00

Basically I have a list of environmental variables that I need to set from

  • 0

Basically I have a list of environmental variables that I need to set from an external file. Here’s what i’m trying to do…

file: /usr/local/env

export EC2_PRIVATE_KEY=~/.ec2/pk-xxxxx.pem
export EC2_CERT=~/.ec2/cert-xxxxx.pem
export EC2_URL=https://ec2.us-east-1.amazonaws.com
export EC2_HOME=/opt/aws/apitools/ec2
export JAVA_HOME=/usr/lib/jvm/jre

file: /usr/local/test.sh

source /usr/local/env
ec2-describe-instances

When i run /usr/local/test.sh i get /bin/ec2-cmd: No such file or directorybe-instances: line 11: /opt/aws/apitools/ec2

So i check the variables and notice that when:

[root@ip-10-244-17-106 ~]# set | grep EC2
EC2_AMITOOL_HOME=/opt/aws/amitools/ec2
EC2_CERT=$'~/.ec2/cert-xxxxx.pem\r'
EC2_HOME=$'/opt/aws/apitools/ec2\r'
EC2_PRIVATE_KEY=$'~/.ec2/pk-xxxxx.pem\r'

and when i run:

[root@ip-10-244-17-106 ~]# env | grep EC2
EC2_HOME=/opt/aws/apitools/ec2
EC2_URL=https://ec2.us-east-1.amazonaws.com
EC2_PRIVATE_KEY=~/.ec2/pk-xxxxx.pem
EC2_CERT=~/.ec2/cert-xxxxx.pem

Why does source wrap $'<variable>\r’ around all my values? I think this is why i’m getting the error. Anyone have any help?

  • 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-31T02:04:18+00:00Added an answer on May 31, 2026 at 2:04 am

    Unix terminates a line with a Line Feed character, frequently described with the C escaping convention as \n. Windows terminates a line with both a Carriage Return and a Line Feed character, or \r\n. So the actual first line in your sourced file is

    export EC2_PRIVATE_KEY=~/.ec2/pk-xxxxx.pem\r\n

    Unix knows to recognize the \n as the end-of-line, but thinks that the \r is just more of the text from that line.

    You can strip that with

    dos2unix /usr/local/env

    Also, some text editors on Windows also offer the option to save with \n line termination.

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

Sidebar

Related Questions

Basically what I have here is a button that adds a new list item
So I have site list on certain pages that basically just have links to
i am trying to do a groupby in linq, basically i have a list
Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These
Okay, basically, I have a large list of phone numbers in a text file
I have application reads in data from text file. Recently I realized that I
Basically I have a list and I need to remember the offset and load
Basically I have a list of methods that I want to iterate through, call
So basically I have a Linked List class that has all of the constructor
Can someone suggest what I am doing wrong? Basically I have a List Items,

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.