...
 
Commits (2)
......@@ -24,5 +24,21 @@ echo "$search"
echo "search=\"$search\"; executing 'echo \$search'"
echo $search
# WARNING: Wrong: Using unquoted values containing spaces as pathnames.
oldpwd=$PWD
cd /tmp
path="foo bar"
filename=$path/baz
echo "Creating directory: path=\"$path\""
mkdir -p $path
echo "Creating file: filename=\"$filename\""
touch $filename
cd "$oldpwd"
# syntastic=off
# vim: ai et sts=4 ts=4 sw=4
ShellCheck
==========
Installing Shellcheck
---------------------
```shell
apt install cabal-install
cabal update
cabal install ShellCheck
echo 'export PATH="$HOME/.cabal/bin:$PATH"' >> ~/.bashrc
```
Integration with the Vim
------------------------
### Installing Pathogen
-----------------------
```shell
mkdir -p ~/.vim/autoload ~/.vim/bundle
wget \
-O ~/.vim/autoload/pathogen.vim \
https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
sed -i '1iexecute pathogen#infect()\n' ~/.vimrc
```
### Installing Syntastic
------------------------
```shell
git clone --depth=1 \
https://github.com/vim-syntastic/syntastic.git \
~/.vim/bundle/syntastic
```
These are recommended initial settings:
```shell
cat >> ~/.vimrc <<EOF
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
EOF
```
Customizations for this Project
-------------------------------
Some script files in this project contain a comment that is intended to disable
Synastic on that specific file:
```shell
# syntastic=off
```
The behavior can be enabled by adding the following line to `~/.vimrc`:
```vimscript
au BufEnter *.bash,*.sh :if search("^# syntastic=off$") > 0 | let b:syntastic_mode = "passive" | SyntasticReset | endif
```
Notes about Syntastic
=====================
Some script files contain a comment like this:
```shell
# syntastic=off
```
This is intended to disable Synastic/shellchecker on the script file.
Users of Vim/Syntastic/shellchecker can enable this behavior by adding the following line to `~/.vimrc`:
```vimscript
au BufEnter *.bash,*.sh :if search("^# syntastic=off$") > 0 | let b:syntastic_mode = "passive" | SyntasticReset | endif
```