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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:20:08+00:00 2026-05-24T09:20:08+00:00

Hello friendly guys. On Linux with Bash, I often need to list environment variables(env-var)

  • 0

Hello friendly guys. On Linux with Bash, I often need to list environment variables(env-var) whose names start with some predefined word. For example, to list all env-vars with name pattern gmXXX, I will do

[chj @linux-ic37 ~]$ export|grep '^declare -x gm'
declare -x gmu_DO_SHOW_COMPILE_CMD="1"
declare -x gmu_DO_SHOW_LINK_CMD="1"

But writing that long command everytime is boring. So, can I write an alias to simplify it? I tried but no luck.

[chj @linux-ic37 ~]$ alias fvgm="export|grep \'^declare -x gm\'"

[chj @linux-ic37 ~]$ fvgm
grep: gm': No such file or directory

Can anyone help me out?

To make it further, can I go as far as having ‘gm’ parameterized, like

fv gm

to list all env-var starting with ‘gm’ ?

  • 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-24T09:20:08+00:00Added an answer on May 24, 2026 at 9:20 am

    You don’t need to escape the single-quote in your alias. Change it to:

    alias fvgm="export|grep '^declare -x gm'"
    

    You need to write a function to make it generic. For example:

    fv(){
        export | grep "^declare -x $1"
    }
    

    You can then call:

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

Sidebar

Related Questions

Hello all friendly Windows Mobile Developers! I have a simple question: Can I distribute
Hello friendly computer people, I'm new to R and am getting a bit lost
Hello I need to generate a report which would include both data and a
Hello guys I am having some problems with exact matches while doing a NamedQuery.
Hello friendly computing people, This is a two part question. I'm writing two shell
Hello all I need Apache server with php interpreter to distribute in my desktop
Hello all I need to encrypt text what is the best encryption to use
Hello everyone i need to convert this code to a function with 2 parameters
Hello guys I am working on silverlight and I have issue regarding on database
Hello Guys, I was just trying to create a plugin, and I needed it

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.