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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:16:50+00:00 2026-06-13T01:16:50+00:00

I need to do some integer math in csh (and no, other shells are

  • 0

I need to do some integer math in csh (and no, other shells are not an option, nor is bc, nor is perl, nor is python, period).

In bash my task would look like

seq 1 1 10 > m.txt  #supplied from elsewhere
a=2                 #supplied from elsewhere
b=3                 #supplied from elsewhere
head -n $[$a*$b] m.txt # the line in question

then the question is Is there an expression in csh that computes $[$a*$b] inline?
I know that I can do @ c = $a * $b in csh, but that’s not inline. I did a little bit of googling and searching SO, but no success so far, so any help is greatly appreciated!

  • 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-13T01:16:51+00:00Added an answer on June 13, 2026 at 1:16 am

    Are your use of square-brackets meant to indicate an array notation or matrix math? csh has no such built-in features.

    ELSE, if you mean like bash $(($a * $b)), you can use csh cmd-substitution with backquotes to give you

    head -n `expr $a \* $b` m.txt
    

    Note that if your goal was to avoid spawning extra processes, this does not meet your goal, but it is “in-line”

    Edit I see I mistyped as $( $a * $b ), see inline correction above.

    IHTH.

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

Sidebar

Related Questions

I need to do some large integer math. Are there any classes or structs
hello guys i need to sort some elements of integer in an integer array
I need some table like this one: uid:integer pid:integer predesposition:integer primary_key(uid,pid) foreign_key(uid, user(id)) foreign_key(pid,
I need plus some value to integer column for many records in db. I'm
I need some help with using integer from one activity to another. I am
I need some help in retaining an integer datatype through serial communication. My setup
Given an integer value, I need some way to find out the minimum number
For some reasons I need the Integer and the Fraction part of a Double
I need to convert some strings, and pull out the two first integers e.g:
Need some regular expressions help. So far I have my code working to allow

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.