Cygwin and imagemagick - shell

Its been 15 years since I used Unix ksh shell, bash now. It's coming back to me but I spent a lot of time trying to get the basic interactive shell to not only like my scripts and syntax, I read man pages on setting up .bashrc and such but nothing.
example: I could not source anything till i took out all the "." chars in function names and file names, still could not get the functions and vars to load from a sourced script back to the caller... and then finally.... discovered the problem was using " 2>&1 $LOGFILE" on my calls when sourceing. go figure. days wasted.
I now have bash kinda working enough to try to install image magick 6.8.8 but its not working either. I followed the instructions for installing, expanded the tar ball, set the env var, added to path before all others. like the source issue i had the shell finds the IM commands, in the right folder and runs them, they just dont do anything. all i get is a CR/LF when entering any IM exe.
Thats why i am asking now, seems like some flag I am not setting..
do I need to register the dlls? why are they .exe files?
What am I forgetting to do?
Also do you have any good default settings or tips on setting up bash shell to work with and debug lots of bash
GNU bash, version 4.3.42(4)-release (x86_64-unknown-cygwin)
cygwin64 on Windows7."
ImageMagick-6.8.8
here is the relevant part of the env...
$ ls -l convert.exe compare.exe
-rwxr-xr-x 1 Administrators None 74892 Jan 27 2014 compare.exe
-rwxr-xr-x 1 Administrators None 74316 Jan 27 2014 convert.exe
$ which convert
/home/ripple/ImageMagick-6.8.8/bin/convert
ripple#prp-lap-tos ~
$ convert.exe -version
convert.exe -version
ripple#prp-lap-tos ~
========================================
============================
$ **env**
HOMEPATH=\Users\ripple
ProgramW6432=C:\Program Files
HOSTNAME=prp-lap-tos
SHELL=/bin/bash
TERM=xterm
PROCESSOR_IDENTIFIER=AMD64 Family 15 Model 104 Stepping 2, AuthenticAMD
PROFILEREAD=true oRIGINAL_PATH=/cygdrive/c/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows
USER=ripple
!::=::\
LD_LIBRARY_PATH=/home/ripple/ImageMagick-6.8.8/lib
USERNAME=ripple
PROCESSOR_LEVEL=15
PATH=/home/ripple/bin:/home/ripple/ImageMagick6.8.8/bin:/usr/local/bin:/usr/bin:/cygdrive/c/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
FP_NO_HOST_CHECK=NO
PWD=/home/ripple/ImageMagick-6.8.8/bin
LANG=en_US.UTF-8
TZ=America/Denver
PS1=\[\e]0;\w\a\]\n\[\e[32m\]\u#\h \[\e[33m\]\w\[\e[0m\]\n\$
MAGICK_HOME=/home/ripple/ImageMagick-6.8.8
PROCESSOR_ARCHITECTURE=AMD64
EXECIGNORE=*.dll
SHLVL=1
HOME=/home/ripple
INFOPATH=/usr/local/info:/usr/share/info:/usr/info
_=/usr/bin/env
==================================
from .**bashrc**
export MAGICK_HOME="$HOME/ImageMagick-6.8.8"
export PATH="$MAGICK_HOME"/bin:$PATH
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$MAGICK_HOME/lib
export LD_LIBRARY_PATH
==================================================
$ **shopt**
autocd off
cdable_vars on
cdspell on
checkhash on
checkjobs off
checkwinsize on
cmdhist on
compat31 off
compat32 off
compat40 off
compat41 off
compat42 off
completion_strip_exe off
complete_fullquote on
direxpand off
dirspell off
dotglob off
execfail off
expand_aliases on
extdebug off
extglob on
extquote on
failglob off
force_fignore on
globstar off
globasciiranges off
gnu_errfmt off
histappend on
histreedit on
histverify on
hostcomplete on
huponexit off
interactive_comments on
lastpipe off
lithist off
login_shell on
mailwarn off
no_empty_cmd_completion on
nocaseglob on
nocasematch off
nullglob off
progcomp on
promptvars on
restricted_shell off
shift_verbose off
sourcepath on
xpg_echo off
scripts
!#/bin/bash -x
which does not seem to work right either, its not echoing like I thought.
been playing with these commands too.
#set +n
#set +C
#set -o posix
#set -euo pipefail
thanks,
Ripple Ratt
Phat Ratt Photography

If the goal is to install imagemagick on Windows, consider the chocolatey package manager.
ImageMagick 6.9.3.7 is available, so after installing chocolatey, one would run:
choco install imagemagick

Related

How can I use aliases in bash scripts without changing the scripts?

I know writing
source ~/.bashrc
shopt -s expand_aliases
in a bash script allows to use aliases defined in .bashrc file.
However, I have so many bash scripts, and I cannot change all those scripts.
Is there a way to let my aliases used in all my scripts, with setting env or something?
Put the code that enables aliases and sources .bashrc to another file, assign its path to BASH_ENV, and export BASH_ENV.
$ cat .bashrc
alias dt=date
$ cat my_env.sh
shopt -s expand_aliases
source ~/.bashrc
$ cat my_script
#!/bin/bash
dt
$ export BASH_ENV=my_env.sh
$ ./my_script
Tue Mar 30 07:57:50 +03 2021

How to activate FULL $var completion

under Debians BASH I can do the following:
foo=/path/to/some/file
cat $f[TAB]
As you can see, I can autocomplete the variable $foo by pressing TAB.
Under Ubuntu (11) the behaviour is not the same (I've activated '/etc/bash_completion' in my bashrc).
This is working:
echo $f[TAB]
This one is not working:
cat $f[TAB]
Can anyone give me a hint, how to get the last one working?
You can remove the completion specification provided for cat by /etc/bash_completion by doing:
complete -r cat
or you can see if modifying the completion options provided in /etc/bash_completion work in the version of Bash you're using:
complete -F _longopt -o filenames -o bashdefault cat
If you're using the latest patched version of Bash 4.2, there is an option that may help (I haven't tried it):
shopt -s direxpand

What does shopt -s dirspell do?

I cannot figure it out, i understand shopt -s cdspell but cannot find out what shopt -s dirspell does.
The Bash Reference Guide says:
dirspell
If set, Bash attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist.
I tried several times on several directories but that is not the behavior.
I'm using bash 4.2.10(2) on i386-apple-darwin10.7.0
From the change-log
x. There is a new shell option: `dirspell'. When enabled, the filename
completion code performs spelling correction on directory names during
completion.
Let's try:
$ ls
spam/
$ cat spam/test
hello world
without dirspell
$ cat span/test [tab]
# nothing happens
with dirspell
$ shopt -s dirspell
$ cat span/test [tab]
#line is replaced by
$ cat /home/user/tmp/shopt/spam/test
If you set the shell options direxpand and dirspell, then the tab-completion does work.

Unable to enable globstar in Bash 4

I put the following unsuccessfully to my .bashrc
shopt -s globstar
I am trying to test the command in action by
ls **/*.c
and by comparing it to
ls */*/*.c
How can you enable globstar in Bash 4?
Hmm. shopt -s globstar should work.
To debug, make sure you are running Bash 4:
$SHELL --version
Then check the setting of globstar:
shopt globstar
If it is unset, try setting it manually:
shopt -s globstar
Now see if that works. If it does, you might want to look into why your .bashrc isn't working. Did you remember to restart you shell after editing your .bashrc, or load it with . .bashrc?

Unable to use Checkjobs and Autocd in Bash 4

There are new options in Bash 4: checkjobs and autocd.
However, I did not find documentation for them at
man bash
I run unsuccessfully
{checkjobs,autocd}
I found the following in release notes
There is a new `checkjobs` option that causes the shell to check for and
report any running or stopped jobs at exit
and
There is a new `autocd` option that, when enabled, causes bash to attempt
to `cd` to a directory name that is supplied as the first word of a
simple command.
How can you use autocd and checkjobs?
autocd and checkjobs are not commands, but rather, they are options.
They can be set by using the shopt built-in.
Example:
shopt -s autocd
and
shopt -s checkjobs
or
shopt -s autocd checkjobs
to set both.

Resources