Export: '0.0' : not a valid identifier in Bash - bash

I am fairly new to Bash scripting and am trying to set environment and libraries to use and then build a particular script. Here is the Bash script I wrote:
#! /bin/bash
export DISPLAY :0.0
#setenv LD_LIBRARY_PATH /usr/local/szip2.1/lib:${LD_LIBRARY_PATH}
# above line should be equivalent to
export LD_LIBRARY_PATH "/usr/lib64:/usr/lib:$LD_LIBRARY_PATH"
module load Szip/2.1-gmpolf-2015
module load cuda/6.5
#while ( 1 )
cd /home/sbansal6/misr-stereo-2013.11.24
/home/sbansal6/misr-stereo-2013.11.24/bin/misr-stereo /home/sbansal6/ellipsoids/0034007 AN AA
#end
And here is what I get as the error:
[sbansal6#cg-gpu01 STEREO]$ ./mstdrv.csh
./mstdrv.csh: line 3: export: `:0.0': not a valid identifier
./mstdrv.sh: line 6: export: `/usr/lib64:/usr/lib:/sw/cuda/6.5/lib64:/sw/EasyBuild/software/Szip/2.1-gmpolf-2015/lib:/sw/EasyBuild/software/ScaLAPACK/2.0.2-gmpich-2015-OpenBLAS-0.2.14-LAPACK-3.5.0/lib:/sw/EasyBuild/software/FFTW/3.3.4-gmpich-2015/lib:/sw/EasyBuild/software/OpenBLAS/0.2.14-GCC-4.9.2-binutils-2.25-LAPACK-3.5.0/lib:/sw/EasyBuild/software/MPICH/3.1.4-GCC-4.9.2-binutils-2.25/lib:/sw/EasyBuild/software/GCC/4.9.2-binutils-2.25/lib/gcc/x86_64-unknown-linux-gnu/4.9.2:/sw/EasyBuild/software/GCC/4.9.2-binutils-2.25/lib64:/sw/EasyBuild/software/GCC/4.9.2-binutils-2.25/lib:/sw/binutils-2.25/lib': not a valid identifier
/home/sbansa16/misr-stereo-2013.11.24/bin/misr-stereo:error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory
I am basically trying to add the libraries from Szip and Cuda in my environment and then build a C++ program which is at the path I wrote later. I do understand that the last error that I got which said error while loading shared libraries: libglut.so.3 is because I don't have that library in my libraries.
I am sorry if this question is trivial. I appreciate any help. Thanks in advance.
UPDATE:
I have also tried using setenv from csh but it is still not working.

Bash syntax for setting an environment variable would be:
export NAME=value
or
NAME=value
export NAME

Related

Grub throws "can't find command `['." when adding conditional to grub.cfg

It was my understanding that grub supports a small subset of bash. Their documentation doesn't go into super detail, other than it "supports conditionals", etc.
I am trying to run a simple if.
grub> if [ "${myvar}" = "fred" ]; then
> echo "test"
> fi
error: can't find command `['.
Anybody have an idea? I am using grub2-efi 2.00.
You are missing a grub2 module in order to run if tests.
I'm running Gentoo on a PowerPC system (PPC64 G5 machine) and doing a default grub-mkconfig then booting from it gives me the error in your question.
Since bash has that syntax support, I figured it was simply a grub module that needed to be added (I had been doing work with grub modules recently).
tl;dr: You need to load the appropriate grub module and then the error goes away.
The first step is to find out what modules you have. For me, it's whatever is available in my /boot/grub/powerpc-ieee1275/ folder.
There's also modules in /usr/lib/grub/powerpc-ieee1275/.
I wrote up a list of modules I thought I needed:
normal
eval
read
test
test_blockarg
trig
true
I then added them to my /etc/default/grub file:
GRUB_PRELOAD_MODULES="normal eval read test test_blockarg trig true"
I did not find an entry for GRUB_PRELOAD_MODULES in the config file, so I had to do some searching to find out how. I want these modules to be added every time I generate the grub config file, which means putting them in the 00_header portion of grub.
Then I recreated the configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
The modules were in the header and things worked perfectly on reboot.
If I had to guess: you probably only need the test module to enable if statements.

Why do I get 'Can't locate object method "init" via package "wlgmod::odt"' when I try to run wyd.pl in Cygwin?

I'm trying to run a Perl script called WyD using Cygwin on Windows. Cygwin is installed at C:\cygwin64, and WyD is installed at C:\wyd\wyd.pl. Both are in the Windows PATH environment variable as C:\cygwin64 and C:\wyd respectively.
When running WyD with bash/Mintty using:
wyd.pl -b -e -t -s 3 -o "OUTPUTTEDWORDLIST" "TARGETFOLDER"
...I get the following error:
Can't locate object method "init" via package "wlgmod::odt" (perhaps
you forgot to load "wlgmod::odt"?) at /cygdrive/c/WYD/wyd.pl line 284.
Sometimes wlgmod::odt is replaced with wlgmod::doc or any other document type, but running the script always generates that same basic error. A previous answer to this question recommended installing several dependencies, which turned out to be a mere copy-paste of an answer for Ubuntu systems, and didn't solve the error, so I've decided to start at the beginning and re-ask the question with more details. I also have all Perl packages in the Cygwin installer installed.
After everything I've tried and done to get this script working, I can personally think of two possible causes for the error. Think of these as a guide more than anything else.
The error above references line 284 in the wyd.pl script, so it's possible that something in that script is hardcoded so that it doesn't work with Cygwin/Windows, or just generally has a compatibility bug. I don't understand Perl, so I can't confirm this.
I notice that the installation of WyD at C:\wyd contains a folder called wlgmod, and that folder contains all the files that the above error seems to be looking for; doc.pm, html.pm, jpeg.pm, etc. If those files exist in that directory but bash is unable to find them, maybe it's due to the fact WyD needs to be run from within Cygwin itself. I've only recently thought about this possibility, and my knowledge of both Cygwin and WyD is too sparse to definitively know how both work. Is it even possible to run WyD from within the Cygwin folder? It's not a package so can't be installed as one, and therefore I'm not sure how that would work.
Here are the relevant sections of the script:
# Module hash containing module name and supported file extensions
# Multiple extensions are seperated using ';'
my %wlgmods = (
'wlgmod::strings', '', # only used with command-line switch
'wlgmod::plain' , '.txt', # used for all MIME text/plain as well
'wlgmod::html' , '.html;.htm;.php;.php3;.php4',
'wlgmod::doc' , '.doc',
'wlgmod::pdf' , '.pdf',
'wlgmod::mp3' , '.mp3',
'wlgmod::ppt' , '.ppt',
'wlgmod::jpeg' , '.jpeg;.jpg;.JPG;.JPEG',
'wlgmod::odt' , '.odt;.ods;.odp'
);
...
# Initialize possible modules
foreach(keys %wlgmods) {
eval("use $_;");
my $ret = $_->init(); # line 284
# If module failed, add errortext and remove from hash
if($ret) {
$retvals .= "$_: $ret\n";
delete $wlgmods{$_};
$ret = "";
}
}

Embeddable Common-Lisp asdf:defsystem returning invalid relative pathname

I'm trying to learn how to use Common-Lisp's asdf, and I have the following code:
(asdf:defsystem example
:serial t
:components ((:file "first")
(:file "second")))
However, I keep getting the error:
Condition of type: SIMPLE-ERROR
Invalid relative pathname #P"first.lisp" for component ("example" "first")
I'm launching the repl in the same directory as these two Lisp files, but I don't understand why there is an error. What am I missing? I'm using ECL on Windows
ASDF uses *load-pathname* or *load-truename* to resolve the full paths to the system's components. If you enter the (asdf:defsystem ...) form on the REPL, these variables are not set.
Write the defsystem form into a file, then load it like (load "example.asd").

How to Pass the HTML code via export statment in shell script

I am trying to Export the HTML code via variable to the antoher file, but while trying to exprot i am getting the message like .
Value i am going to export
> VALUESTRING=<a class="modal::content:serviceloc:width:780:height:500 button lq_login"></a>
Error Message:
>line 13: lq_login"': not a valid identifier line 13:
> export: `<span': not a valid identifier
Any one could you check on this.
use proper quotes for variable value:
export VALUESTRING='<a class="modal::content:serviceloc:width:780:height:500 button lq_login"></a>'

Why is LUA_PATH containing a bang (!) mangled on Windows?

I have a file main.lua:
require("hello")
and a file hello.lua in the directory foo bar! baz (with !) in it:
module(...,package.seeall)
print("hello from hello.lua")
when I set (on Windows) the environment variable LUA_PATH to the directory:
set LUA_PATH="C:\Programme\Lua\5.1\foo bar! baz\?.lua"
I get a strange error:
C:\Programme\Lua\5.1>lua main.lua
lua: main.lua:4: module 'hello' not found:
no field package.preload['hello']
no file '"C:\Programme\Lua\5.1\foo barC:\Programme\Lua\5.1 baz\hello.lua
"'
no file '.\hello.dll'
no file '.\hello51.dll'
no file 'C:\Programme\Lua\5.1\hello.dll'
no file 'C:\Programme\Lua\5.1\hello51.dll'
no file 'C:\Programme\Lua\5.1\clibs\hello.dll'
no file 'C:\Programme\Lua\5.1\clibs\hello51.dll'
no file 'C:\Programme\Lua\5.1\loadall.dll'
no file 'C:\Programme\Lua\5.1\clibs\loadall.dll'
stack traceback:
[C]: in function 'require'
main.lua:4: in main chunk
[C]: ?
See the very strange path C:\Programme\Lua\5.1\foo barC:\Programme\Lua\5.1 baz\hello.lua? What is so special about the exclamation mark (bang)? How to get that right in windows? On Mac this seems to be working fine.
"This substitution only happens the first time Lua sets the path
(either from LUA_PATH or from the default from luaconf). If you
set the path by other means, you can avoid the problem."
More info and potential alternatives: http://lua-users.org/lists/lua-l/2012-08/msg00052.html
The explanation is correct (it's documented behavior on Windows), but I can also offer a possible solution (or rather a workaround): since only the first exclamation mark is going to be replaced, instead of using set LUA_PATH="C:\Programme\Lua\5.1\foo bar! baz\?.lua", use:
set LUA_PATH="!\foo bar! baz\?.lua"

Resources