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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:44:17+00:00 2026-05-24T11:44:17+00:00

I wrote a function in Octave that takes in a line read from a

  • 0

I wrote a function in Octave that takes in a line read from a file (one line at a time) as input argument. I use a bash script to read a line at a time from the file and then pass that as argument to the octave function from within the script.

My bash script looks like so:

#!/bin/bash  

while read line
do
  octave --silent --eval 'myOctaveFunc("${line}")'
done < "inFileName"

When I execute above script, octave throws errors like:

error: called from:
error:   /usr/share/octave/3.2.3/m/miscellaneous/fullfile.m at line 43, column 11
error: evaluating argument list element number 2
error: evaluating argument list element number 1
error:   /usr/libexec/octave/packages/gsl-1.0.8/i386-redhat-linux-gnu-api-v37/PKG_ADD at line 47, column 1
error: addpath: expecting all args to be character strings
error: addpath: expecting all args to be character strings
error: addpath: expecting all args to be character strings
error: addpath: expecting all args to be character strings

and so on..

I have been able to run the octave script myOctaveFunc.m with input arguments such as helloWorld from the command line. The problem arises when I try to run it from within the bash script.

My questions are:
1. How do I get the octave function running from within the bash script?
2. I am using gvim to edit the bash script. When I type in the line to invoke the octave script, I see that the ${line} is colored differently as compared to normal circumstances. Is that because of the '' used to invoke the octave function? If so, should I be worried about it?

  • 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-24T11:44:17+00:00Added an answer on May 24, 2026 at 11:44 am

    The single quotes are preventing the shell from substituting the variable:

    octave --silent --eval "myOctaveFunc(\"$line\")"
    

    If octave lets you use single quotes to quote strings, it will look a little cleaner (inside double quotes, single quotes have no special meaning):

    octave --silent --eval "myOctaveFunc('$line')"
    

    Also, from vim, make sure you save the file in unix format so each line does not end with a carriage return character: :set ff=unix

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

Sidebar

Related Questions

I wrote this function that I want to use in a program, but for
I wrote a function that serializes a list of dictionaries as a CSV file
I wrote a function that gets the balance from PayPal. To connect properly I'm
I wrote some function in app_helper file. now i need to call that function
I wrote a function in haskell that takes a few parameters like Word32, String
I wrote a function that does alot of mathematical operations and it takes about
I wrote a function that takes 2 parameters , but calling the function with
I just wrote this function to read a series of email addresses from a
I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000" .
I wrote a function in bash script. However, it's complaining about syntax. I really

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.