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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:26:14+00:00 2026-06-13T12:26:14+00:00

In this example I want it to know if $@ contains two words/symbols load

  • 0

In this example I want it to know if $@ contains two words/symbols “load” and “/”

for one word/symbol this works

    case "$@" in */*)
    ;;
    echo "going to do stuff"
*)
    echo "will do something else"
    ;;
esac

or

string='My string';

if [[ "$string" == *My* ]]
then
  echo "It's there!";
fi

But if two words/symbols appear at random places I cant figure out how to do it.

Update:

The input will the module command. In this case I want to know if it is the module load with or without / that indicate version. the command will look like this

1) module load appname/1.1.1 or
2) module load appname
3) module (not load) (list, avail etc)

It is number 1 I am interested in for now.
3 will in some cases be variation of 1.
2 will be run as is but will include a message to the user

  • 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-13T12:26:14+00:00Added an answer on June 13, 2026 at 12:26 pm

    Something like this is possible:

    if  [[ ${@} =~ .*/.* && ${@} =~ ((^)|([ ]))load(($)|([ ])) ]]
    then
      echo both
    fi
    

    -or-

    if LOAD=0 && SLASH=0 && \
       for ARG in ${@};
       do
         if [ "${ARG#*/}" != "${ARG}" ]; then SLASH=1; fi
         if [ "${ARG}" = "load" ]; then LOAD=1; fi
       done && [ "${LOAD}${SLASH}" = "11" ];
    then
      echo both
    fi
    

    -or-

    function loadslash()
    {
      LOAD=0 && SLASH=0
      for ARG in ${@};
      do
        if [ "${ARG#*/}" != "${ARG}" ]; then SLASH=1; fi
        if [ "${ARG}" = "load" ]; then LOAD=1; fi
      done
      test "${LOAD}${SLASH}" = "11"
    }
    
    if loadslash ${@}
    then
      echo both
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to compare two lists where each list contains about 60,000 objects. what
I will try and explain exactly what I want to achieve first. Imagine two
I'd like to compare two differently spaced datasets in python. I always want to
I have an Address model that contains two float fields, lat and lng .
so actually i'm writing client/server programs using TCP/IP. In this case, client can upload
I need to know how to write a program that runs two threads: 1.
I have a function which contains a loop over two lists and builds up
Let's say my SQL database contains a table called 'Customer'. This Customer has an
I have a web page that contains two textboxes and a button. I can't
I want to create two input ports and two output ports, I have tried

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.