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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:15:24+00:00 2026-05-21T02:15:24+00:00

I am practicing with some Perl scripting and instead of typing the shebang each

  • 0

I am practicing with some Perl scripting and instead of typing the shebang each time I decided to make a basic Unix script that would create a new file with .pl extension and the shebang and then open the file for editing. What I tried was:

alias ep "echo '#! /usr/bin/perl' >> perl/\!*.pl; emacs perl/\!*.pl;"

But this causes an error if the file doesn’t already exist. I found that strange because I thought >> would append or create. So I changed the >> to > and this works but only if the file does not exist. If the file does exist it just crashes with an error. I tried adding an if statement but that also gave errors of syntax error and improper then. What I had for the if was:

alias ep "if [ ! -f perl/\!*.pl ] then echo '#! /usr/bin/perl' > perl/\!*.pl fi; emacs perl/\!*.pl;"

What am I missing? I am not too familiar with Unix scripting, but have a general knowledge.

  • 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-21T02:15:25+00:00Added an answer on May 21, 2026 at 2:15 am

    you don’t want to do it like this; there are a lot of things to take account for (is that really a perl file if it exists already, etc)

    you can do it instead directly with emacs

    check this out: emacs skeletons and auto-insert

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

Sidebar

Related Questions

I'm using g++ on fedora linux 13. I'm just practicing some exercises from my
I have been practicing TDD and (some) XP for a few years now and
I'm practicing on Django and using some online tutorial to build a web blog.
I am practicing with PHP and AJAX but I have some problems! I'm trying
A couple of days ago , I was practicing and I wrote some triggers
Actually i had been practicing some of the java programs today(trying to learn it
I'm trying to get CALayer working so I can start practicing some animations tricks
I'm practicing some examples on model-view programming and have a query why the colors
I have been practicing some old C++ problems to prepare for a few job
I'm practicing Haskell, and writing a summation function that takes in two numbers (upper

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.