Skip to content

Tag: bash

Pipe find command output to ls command

Need to pipe find command output to ls command limiting ls command to a certain date. Sort of a filter by date modified but I want with the format of the ls -lth –full-time. The find command gives me last modified files within 365 days. But ls shows me everything. find gives me: And ls -lth –full-…

In bash how to move row field to column in a text file

I have a .txt file with this record: I would like to convert them like that: I have tried something like: or like but i can’t get it to work I would like the values to be transposed and that each tuple of values associated with a specific field is aligned with the others Any suggestions? Thank you in ad…

exporting list of variables in docker run

We have a set of variables in env file as given below examples.env Now, docker run cannot substitute $B for /path/path1, due to its limitations So, I want to export the variable in launcher script and then call those variable using -e flag, as given below mydocker.sh Now how to create docker command to get al…

Tail a log throughout duration of script (including reboots)

I’m trying to tail a log through the duration of a bash script that involves multiple reboots. The point is to be able to watch the main log to verify what the script is logging. The script runs some code before rebooting. This is repeated an n amount of times that is specified by the user. The problem …

Show colored output in terminal when using the sh command

color.sh When typing $ ./color.sh the terminal outputs in the respective colors. However, when I type $ sh color.sh it does not output in the correct colors. Instead it gives me the output below. Is there any way to make $ sh color.sh print in the respective colors? Thanks. Answer Use this codes But better us…

Bash: Date-epoch with systemd

I execute the following line in a bash console. The content of my.log is as expected. Now I change the timestamp to epoch (format-code +%s). File is As expected again. But if I put this command line into systemd it would fail. produces Must be a problem with the format-code of date. If I remove the +%s then i…