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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:30:54+00:00 2026-05-13T15:30:54+00:00

I know how to configure aliases in bash, but is there a way to

  • 0

I know how to configure aliases in bash, but is there a way to configure an alias for a sequence of commands?

I.e say I want one command to change to a particular directory, then run another command.

In addition, is there a way to setup a command that runs “sudo mycommand”, then enters the password? In the MS-DOS days I’d be looking for a .bat file but I’m unsure of the linux (or in this case Mac OSX) equivalent.

  • 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-13T15:30:54+00:00Added an answer on May 13, 2026 at 3:30 pm

    You mention BAT files so perhaps what you want is to write a shell script. If so then just enter the commands you want line-by-line into a file like so:

    command1
    command2
    

    and ask bash to execute the file:

    bash myscript.sh
    

    If you want to be able to invoke the script directly without typing “bash” then add the following line as the first line of the file:

    #! /bin/bash
    command1
    command2
    

    Then mark the file as executable:

    chmod 755 myscript.sh
    

    Now you can run it just like any other executable:

    ./myscript.sh
    

    Note that unix doesn’t really care about file extensions. You can simply name the file “myscript” without the “.sh” extension if you like. It’s that special first line that is important. For example, if you want to write your script in the Perl programming language instead of bash the first line would be:

    #! /usr/bin/perl
    

    That first line tells your shell what interpreter to invoke to execute your script.

    Also, if you now copy your script into one of the directories listed in the $PATH environment variable then you can call it from anywhere by simply typing its file name:

    myscript.sh
    

    Even tab-completion works. Which is why I usually include a ~/bin directory in my $PATH so that I can easily install personal scripts. And best of all, once you have a bunch of personal scripts that you are used to having you can easily port them to any new unix machine by copying your personal ~/bin directory.

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

Sidebar

Related Questions

I want to know how to configure your environment to execute some command with
I know I can configure command line arguments in the Run configuration but I
I'm using Tomcat 6.0, and I want to know how can I configure Tomcat's
Please i want to know how to configure the SMTP for Swiftmailer in Symfony2.
I can't find javadoc for Hessian lib. I want to know how to configure
It's pretty wierd, but I do not know what to configure or where to
I am working on jsp. I have eclipse but don't know how to configure
I want to know how to configure my DNS zone file in GoDaddy for
I know I can configure tt_news to automatically set author and email to a
I just wanted to know how to configure FCKEditor to upload files and images

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.