Delete new line after shell command


I have a code:

#/bin/sh

cd ~/Desktop/tmp
date "+%m%d%y_%H%M%S_" | xargs -0 mkdir;

This will create a directory with the current date.
The problem here is that the command datewill return a date with a newline at the end.
After the mkdircreated folder will contain a new line.
Does anyone know how to do this? I need a folder name without a newline.
Thank.

+3
source share
2 answers

why do you pass it on xargs? Don't do unnecessary

mkdir $(date "+%m%d%y_%H%M%S_")
+6
source

, -0, xargs (ASCII 000) . . -0 , xargs ( ) , .

ghostdog74, .

+2

Source: https://habr.com/ru/post/1785844/


All Articles