how to tell the version number of dash? - linux

I have a dash shell installed as /bin/dash. I checked the manual of dash, which is the same as the POSIX shell manual, and there is nothing there to tell the version of the shell.
dash --version
does not work.
How to tell the version number of dash I have??
Added: some people are pointing me to Ubuntu commands, well, no I am not running Ubuntu, I am running Centos.

dpkg -s
Run the following command:
dpkg -s dash

On systems like Centos that use rpm:
rpm -q dash

Related

How could I use fish( or zsh) rather than default bash in a anaconda enviroment

I installed anaconda and fish, and i run the following commands
> echo /usr/local/bin/fish | sudo tee -a /etc/shells
> chsh -s /usr/local/bin/fish
then i restart the terminal, it says
(base) username#pop-os:~$
i realize it's the base environment of conda, then after search, I run another command
conda init fish
then restart the terminal, it's still a bash rather than fish.
is there any way i can benefits both from conda and fish at the same time?
All I need to do is reboot my system so the change of default terminal will be set.
Also, I misunderstand the conda people could refer to the comments to say details.

why bash changing my command 'mysql*' to 'mysql.sql'?

I am sure that there is no such file called mysql.sql in the directory
The operating system infor
cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
I have a shell script. One line is returning nong zero code
yum install -y mysql* 1>/dev/null 2>/dev/null
When I run this line in terminal, everything is fine and the return code( echo $?) is zero.
But in script, it will return 1 and whith the -x option, I can see bash changing the line into
yum install -y mysql.sql
So why mysql* is changed to mysql.sql?
There is a file called mysql.sql in the current directory of the script.
Quote the argument to avoid bash expanding it, so that yum can.
yum install -y "mysql*" 1>/dev/null 2>/dev/null
In general, you always want to quote arguments with * if you don't want them expanded as a glob. Bash by default passes them through literally if they don't match anything, but you can't usually guarantee that, so it's best to just quote it.

how to install anaconda / miniconda on Linux silently

How do I install the anaconda / miniconda without prompts on Linux command line?
Is there a way to pass -y kind of option to agree to the T&Cs, suggested installation location etc. by default?
can be achieved by bash miniconda.sh -b (thanks #darthbith)
The command line usage for this can only be seen with -h flag but not --help, so I missed it.
To install the anaconda to another place, use the -p option:
bash anaconda.sh -b -p /some/path
AFAIK pyenv let you install anaconda/miniconda
(after successful instalation)
pyenv install --list
pyenv install miniconda3-4.3.30
For a quick installation of miniconda silently I use a wrapper
script script that can be executed from the terminal without
even downloading the script. It takes the installation destination path
as an argument (in this case ~/miniconda) and does some validation too.
curl -s https://gist.githubusercontent.com/mherkazandjian/cce01cf3e15c0b41c1c4321245a99096/raw/03c86dae9a212446cf5b095643854f029b39c921/miniconda_installer.sh | bash -s -- ~/miniconda
Silent installation can be done like this, but it doesn't update the PATH variable so you can't run it after the installation with a short command like conda:
cd /tmp/
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -u
Here -b means batch/silent mode, and -u means update the existing installation of Miniconda at that path, rather than failing.
You need to run additional commands to initialize PATH and other shell init scripts, e.g. for Bash:
source ~/miniconda3/bin/activate
conda init bash

Windows Linux Bash bad variable name when running /bin/sh -c "$(curl -fsS https://install.airshipcms.io)"

everything was working until I changed my mobo/cpu and I'm not sure what the error message means.
After running the install command
/bin/sh -c "$(curl -fsS https://install.airshipcms.io)"
my windows ubuntu bash shell returns
Starting Airship Launcher installation for ubuntu Linux64
Will install version 2.1.1
Downloading https://install.airshipcms.io/Linux64/airship-2.1.1.tar.bz2
To /tmp/AirshipLauncher.65/airship-2.1.1.tar.bz2
Added ~/.airship-bin to $PATH in ~/.profile
/bin/sh: 504: export: (x86)/Intel/iCLS: bad variable name
My guess was that because I already had it installed pre-upgrade of the mobo/cpu the variable name is already taken in the ~/.profile ? I'm not sure how to edit it, when I ran cat ~/.profile it rendered a bunch of unreadable characters.
thank you.
edit: I've tried reinstalling my linux shell, to no avail.
Okay so the fix is to replace sh with bash so the working command was
/bin/bash -c "$(curl -fsS https://install.airshipcms.io)"
credit goes to this guy https://github.com/probonopd/PowerShell/commit/2441d99a7405b488dc9289789edb636dc2cdcdfc

How do I identify the particular Linux flavor via command line?

I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g. Ubuntu vs Fedora, via a command line command.
Some people recommend uname -a, but that only reports the kernel version.
Try the below command....
It worked for me...
cat /proc/version
Once you know that you are running Red Hat for example, you can get to the point with:
cat /etc/redhat-release
Or on Debian:
cat /etc/debian_version
or in general :
cat /etc/*-release
Also you could use the following command
cat /etc/issue
For displaying details including release and codename of the distro
lsb_release -a
You can try:
echo $(lsb_release -si)
Try hostnamectl. It lists the operating system, CPE OS Name, Kernel, Architecture, etc.

Resources