My console is not able to recognize ic command in a bash script.
I need to run this command to do some calculation but I get this message ic: command not found
.
How could I define it in the bash?
The error message that you are getting indicates that the command ic
is not present in any of the directories contained in the PATH
environment variable.
To find the directories that bash searches for executable files type the following at the command line
echo $PATH
If you know where the ic
command is on your file system then you could specify the full path to ic in your bash script so that it does not have to use the PATH environment variable to find it.
So lets say that ic was in the directory /usr/local/bin
then in your bash script you could execute ic by entering.
/usr/local/bin/ic
rather than
ic
PATH=:$PATH:/usr/local/bin
someplace in their environment.) Good luck to all.
The message ic: command not found.
indicated that the command ic was not found. In other words, it is not in one of the places where your shell looks for the command.
Usually this is because the command is in the current directory, which (unlike in the default in windows) is not in the default search path.
If this is the case then you can either start it with supplying the full path or by adding the path it is in to the search path.
Examples:
/usr/local/bin/ic
to start a program called ic in the folder /usr/local/bin//opt/bin/ic
to start a program called ic in the folder /opt/bin/./ic
to start a program called ic in the current directory.PATH=:$PATH:.
and not PATH=.:$PATH
. ($PATH is the old path, the colomn is a separator, the dot is the current directory).If ic is a script then you can also start it by invoking its interpreter.
For example if ic is a bash script then you can use /usr/local/bin/bash ic
If ic is a script and the current directory is already in you path then check these three things:
chmod +x ic
).#!
at the very first line in the script. It must be the first line. No empty lines above it. For a bash script the proper entry is #!/usr/local/bin/env bash
. (#!/usr/local/bin/bash
will also work if your bash is in /usr/local/bin, but if you move to another system where it is installed in a different place then you will need to edit that file. The env program (which is always installed in the same place) solves that issue.)bash^M
, and this might not be obvious when a helpful (as in clippy style helpful editor decides to help you by not showing the ^M's).ic
is now called nickle
, as explained here. You can obtain it from nickle.org, but it would be better if you could use your distribution's package manager as I think it has some dependencies. For example, on an Ubuntu system, you can install it with
sudo apt-get install nickle
Then you can either change your script to use nickle
instead of ic
, or you can link nickle
to ic
, e.g.,
ln -s /usr/bin/nickle ~/bin/ic
bc
ordc
?ic
is a calculator similar tobc
but with more capability. It was renamed some time ago but I can't find the new name at the moment. You'll have to install the new package and either change your script to use the new name or link the new name toic
. I'll see if I can find the new name.nickle
and you can find it atnickle.org
.