"Undefined variable" error when running tcsh script


Senna

I'm trying to execute every script that has "~SAC" at the end of the filename. For this, I wrote tc shell script using "foreach" like the code below.

However, when I execute it by typing ./run.tcsh, it just shows "tmpdir: Undefined variable". ("tmpdir" is the directory with all the files I want to apply my code to) How can I fix this?

#!/bin/tcsh

set inputdir=tmpdir
foreach sacfile(`find $tmpdir -name '*.SAC'`)
  echo "processing $sacfile"
  classic_LR $sacfile
end

My execution file is named "classic_LR" and it executes with the following input form;

./classic_LR sacfile

where "sacfile" refers to the name of the file to which I want to apply classic_LR.

Codeforester

Your variables are inputdirand are not tmpdir.

So, change

foreach sacfile(`find $tmpdir -name '*.SAC'`)

to

foreach sacfile(`find $inputdir -name '*.SAC'`)

Related


Simple script with error, undefined variable

Prim1Tive I'm trying to write a very basic sleep interval script and a startup script, but for some reason I can't understand, I get an error message Code: def intervals(): while True: try: interval = input('[?] Intervals in seconds [de

Exit tcsh script on error

arm I am trying to write a tcsh script. A script exit is required if any command of the script fails. In the shell, I use set -ebut I don't know its equivalent in tcsh #!/usr/bin/env tcsh set NAME=aaaa set VERSION=6.1 #set -e equivalent #do somthing thanks

Exit tcsh script on error

arm I am trying to write a tcsh script. A script exit is required if any command of the script fails. In the shell, I use set -ebut I don't know its equivalent in tcsh #!/usr/bin/env tcsh set NAME=aaaa set VERSION=6.1 #set -e equivalent #do somthing thanks

Exit tcsh script on error

arm I am trying to write a tcsh script. A script exit is required if any command of the script fails. In the shell, I use set -ebut I don't know its equivalent in tcsh #!/usr/bin/env tcsh set NAME=aaaa set VERSION=6.1 #set -e equivalent #do somthing thanks

Error when showing undefined variable

Shah Error: _co.bellowContent is undefinedThere was an error displaying the data . You can quote my code below. There was an error Error: _co.bellowContent is undefineddisplaying the data . You can quote my code below. app.component.html <table class="table">

Error when showing undefined variable

Shah Error: _co.bellowContent is undefinedThere was an error displaying the data . You can quote my code below. There was an error Error: _co.bellowContent is undefineddisplaying the data . You can quote my code below. app.component.html <table class="table">

Error when showing undefined variable

Shah Error: _co.bellowContent is undefinedThere was an error displaying the data . You can quote my code below. There was an error Error: _co.bellowContent is undefineddisplaying the data . You can quote my code below. app.component.html <table class="table">

Undefined variable: Error running raw SQL query

Muhammad I'm trying to insert data using laravel's raw SQL statement DB::statement()but the problem is when I run the console in the seeder it thinks the password is variable and not a string this is the code DB::statement("INSERT INTO `users` (`id`, `email`,

Undefined variable: Error running raw SQL query

Muhammad I'm trying to insert data using laravel's raw SQL statement, DB::statement()but the problem is when I run the console in the seeder it thinks the password is variable, not a string this is the code DB::statement("INSERT INTO `users` (`id`, `email`, `p

Undefined variable: Error running raw SQL query

Muhammad I'm trying to insert data using laravel's raw SQL statement, DB::statement()but the problem is when I run the console in the seeder it thinks the password is variable, not a string this is the code DB::statement("INSERT INTO `users` (`id`, `email`, `p

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

Undefined variable when running Ansible play

Souciance Eqdam Rashti I am running multiple ansible plays defined in a YAML file. In the last game, I got the following error: {"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating condi

I have an undefined variable error in my script

Zillacer Technician I am making a login and registration system using PHP and this is the error I am getting on the registration page when defining a variable for user_id Fatal error: Uncaught Error: Call to undefined function random_num() in C:\xampp\htdocs\l

I have an undefined variable error in my script

Zillacer Technician I am making a login and registration system using PHP and this is the error I am getting on the registration page when defining a variable for user_id Fatal error: Uncaught Error: Call to undefined function random_num() in C:\xampp\htdocs\l

I have an undefined variable error in my script

Zillacer Technician I am making a login and registration system using PHP and this is the error I am getting on the registration page when defining a variable for user_id Fatal error: Uncaught Error: Call to undefined function random_num() in C:\xampp\htdocs\l

I have an undefined variable error in my script

Zillacer Technician I am making a login and registration system using PHP and this is the error I am getting on the registration page when defining a variable for user_id Fatal error: Uncaught Error: Call to undefined function random_num() in C:\xampp\htdocs\l

I have an undefined variable error in my script

Zillacer Technician I am making a login and registration system using PHP and this is the error I am getting on the registration page when defining a variable for user_id Fatal error: Uncaught Error: Call to undefined function random_num() in C:\xampp\htdocs\l

Undefined variable error when defining variable

Julien Vincent When defining a variable, I get an "undefined variable" error. bellow is my code <?php $imagepath = $_SESSION['path']; require_once('class-db.php'); if ( !class_exists('INSERT') ) { class INSERT { public function post($postdata) {

Undefined variable error when defining variable

Julien Vincent When defining a variable, I get an "undefined variable" error. bellow is my code <?php $imagepath = $_SESSION['path']; require_once('class-db.php'); if ( !class_exists('INSERT') ) { class INSERT { public function post($postdata) {

Zeppelin error when running Pyspark script

Otis Sistrunk: I'm trying to run an AWS glue job using the dev endpoint and I'm getting this error: org.apache.thrift.transport.TTransportException Just specify what I do out of the box here : https://docs.aws.amazon.com/glue/latest/dg/dev-endpoint-tutorial-lo

VSC throws error when running powershell script

newbie I just started getting the following error when I open a Powershell script in Visual Studio Code. Everything was fine until yesterday. Here is the error: The language service could not be started: Error: The language client requires VS Code version ^1.

Error in bash script when running with LaunchControl

Obromios I have the following script #!/usr/bin/env ruby Dir.chdir('/Users/Chris/Sites/mentor') do audit = `/Users/Chris/.rvm/gems/ruby-2.1.6@mentor/bin/bundle-audit` system(%(osascript -e 'display notification "#{audit}" with title "bundle-audit"')) end