Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

ash

All newlines are removed when saving cat output into a variable

December 25, 2023 by Tarik

The shell is splitting the msgs variable so echo get multiple parameters. You need to quote your variable to prevent this to happen: echo “$msgs”

Categories linux Tags ash, bash, linux, shell Leave a comment

How can I add a new line in a Bash string? [duplicate]

September 17, 2023 by Tarik

$ echo “a\nb” a\nb $ echo -e “a\nb” a b

Categories linux Tags ash, bash, linux, sh, shell Leave a comment

How to get /etc/profile to run automatically in Alpine / Docker

April 4, 2023 by Tarik

The default shell in Alpine Linux is ash. Ash will only read the /etc/profile and ~/.profile files if it is started as a login shell sh -l. To force Ash to source the /etc/profile or any other script you want upon its invocation as a non login shell, you need to setup an environment variable … Read more

Categories docker Tags alpine-linux, ash, docker, sh Leave a comment

does linux shell support list data structure?

February 12, 2023 by Tarik

It supports lists, but not as a separate data structure (ignoring arrays for the moment). The for loop iterates over a list (in the generic sense) of white-space separated values, regardless of how that list is created, whether literally: for i in 1 2 3; do echo “$i” done or via parameter expansion: listVar=”1 2 … Read more

Categories linux Tags ash, bash, linux, shell Leave a comment

What do $? $0 $1 $2 mean in shell script? [duplicate]

December 30, 2022 by Tarik

These are positional arguments of the script. Executing ./script.sh Hello World Will make $0 = ./script.sh $1 = Hello $2 = World Note If you execute ./script.sh, $0 will give output ./script.sh but if you execute it with bash script.sh it will give output script.sh.

Categories bash Tags ash, bash, shell Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa