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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:51:16+00:00 2026-06-01T19:51:16+00:00

lets say I had a file(.csh) File Contents Script_1 { code of script1 }

  • 0

lets say I had a file(.csh)

File Contents

Script_1
{
 code of script1
}

Script_2
{
    code of script2
 }
.
.
.

Script_n
{

 code of script_n

}

Now the thing is if we run like

 ./file.csh -script1 <other arguments>

it should execute only script 1 code
Like wise , if we run

./file.csh  -script2 <other arguments>

it should execute only script 2 code

Can any one tell the idea how to accomplish that?

  • 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-01T19:51:19+00:00Added an answer on June 1, 2026 at 7:51 pm

    You can grab command line parameters via $n where n is integer > 0 in order of argument passed

    #!/bin/csh
    if ($#argv < 1) then
        echo "Usage: $0 (-script1|-script2) <args>"
        exit 0
    endif
    
    if ($1 == '-script1') then
    # run Script_1
    else
    # run Script_2
    endif;
    

    If you’d like to get all arguments except the first one together, you can use shift:

    #!/bin/csh
    
    // without argument by default operates on $argv which is all the arguments 
    // passed via command line
    shift 
    
    echo $argv // now contains all arguments but the first
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I had a Python file, and I wanted to run it in the
Lets say i had a a button that cycles through numbers how can i
So lets say I had a string that was <html> <head><title>301 Moved Permanently</title><head> and
Let's say I had: protected void performLogic(List<Object> docs) { ... } In the code
Lets say I have this code: <?php class hello { var $greeting = hello;
Just to grok this: If I had a transient property, lets say averagePrice, and
I'm building a file by appending text based on different parameters. Lets say my
Originally, I had a MediaPlayer mPlayers to play/pause/stop my Audio file. Now, I'm trying
Let's say I had an xml file like this: <items> <item> <id>1</id> <name>Item 1</name>
Let's say you had to calculate the sine (cosine or tangent - whatever) where

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.