How to write in fish shell

Asked 2 years ago, Updated 2 years ago, 76 views

If the docker service does not start in .bashrc as shown below, I try to start the service.
In the case of fish, how should I write it down?

service docker status>/dev/null2>&1
if[$?=1]; then
    sudo service docker start
fi

linux bash fish

2022-09-30 16:39

1 Answers

First of all, self-solving.
The ubuntu 20.04 fish shell worked as expected in the following ways:
"In the case of fish, I think the ""service docker status>/dev/null2>&1"" part can be written more smartly, but I didn't understand...
" *The comparison value of $status was set to 1 to 3, but for ubuntu 20.04, it had to be set to 3.

service docker status>/dev/null2>&1
if [$status=3]
    sudo service docker start
end


2022-09-30 16:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.