Categories
bash Fedora

ShellCheck – check basic POSIX shell script errors

Here is description of the tool:

Description : The goals of ShellCheck are:
:
: * To point out and clarify typical beginner’s syntax issues,
:   that causes a shell to give cryptic error messages.
:
: * To point out and clarify typical intermediate level semantic
:   problems, that causes a shell to behave strangely and
:   counter-intuitively.
:
: * To point out subtle caveats, corner cases and pitfalls, that may
:   cause an advanced user’s otherwise working script to fail under
:   future circumstances.

To install

dnf install ShellCheck

And just run the tool on the script to get the common errors.

Categories
bash Linux

Paste clipboard is bash or shell scripts with modification.

Today I had a issue where I wanted to paste the clipboard to a shell script after removing the spaces. So, I went hunting for a way to do this. Finally I came up with this:

sudo yum install xclip

Then you can paste the clipboard content using \”xclip -o\”. So now the problem is reduced to selecting the required info and doing :

xclip -o |sed \’s/ //g\’

or

xclip -o|tr -d \’ \’