skip to Main Content

Ubuntu – Can't index of the "#[hello]" in bash

The following index_of function doesn't work for all cases: #!/bin/bash index_of() { local string="$1" local search_string="$2" local prefix=${string/${search_string}*/} local index=${#prefix} if [[ index -eq ${#string} ]]; then index=-1 fi printf "%s" "$index" } a='#[hello] world' b=$(index_of "$a" "world") echo "A:…

VIEW QUESTION

How to install Docker in Ubuntu

While installing Docker Desktop using the command in Ubuntu sudo apt-get install ./docker-desktop-<version>-<arch>.deb I'm getting bash: version: No such file or directory' error. The log is - sudo apt-get install ./docker-desktop-<version>-<arch>.deb Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease Hit:3 http://in.archive.ubuntu.com/ubuntu jammy InRelease Get:4…

VIEW QUESTION
Back To Top
Search