Article 5NXK3 Bash Scripting echo truncate the output

Bash Scripting echo truncate the output

by
procfs
from LinuxQuestions.org on (#5NXK3)
Hi, I am trying yo write a small script to do some file mentance in OCI object storage.

I am trying to echo a variable that was assigned by a command execution.

echo "************************ $DEL_FILE1 -----------------"
Expected - ************************** RUN_FS1_EBSAPPS_20210824.tar ----------------------
Actual - RUN_FS1_EBSAPPS_20210824.tar --------------

Below is a extract from the debug enabled output.

Code:++ BAS_DIR=/u01/backup

export EXE_DIR=$BAS_DIR/ftmcli-v2.4.3

++ export EXE_DIR=/u01/backup/ftmcli-v2.4.3

++ EXE_DIR=/u01/backup/ftmcli-v2.4.3

export BAK_DIR=$BAS_DIR/$DIR_DATE

++ export BAK_DIR=/u01/backup/20210828

++ BAK_DIR=/u01/backup/20210828

export OBJ_STOR=sagtprodapp01_backup

++ export OBJ_STOR=sagtprodapp01_backup

++ OBJ_STOR=sagtprodapp01_backup

export EXE_FTMCLI="java -jar $EXE_DIR/ftmcli.jar"

++ export 'EXE_FTMCLI=java -jar /u01/backup/ftmcli-v2.4.3/ftmcli.jar'

++ EXE_FTMCLI='java -jar /u01/backup/ftmcli-v2.4.3/ftmcli.jar'

export PRO_FTMCLI="--properties-file $EXE_DIR/ftmcli.properties"

++ export 'PRO_FTMCLI=--properties-file /u01/backup/ftmcli-v2.4.3/ftmcli.properties'

++ PRO_FTMCLI='--properties-file /u01/backup/ftmcli-v2.4.3/ftmcli.properties'

export BAK_FILE=RUN_FS1_EBSAPPS_${DIR_DATE}.tar

++ export BAK_FILE=RUN_FS1_EBSAPPS_20210828.tar

++ BAK_FILE=RUN_FS1_EBSAPPS_20210828.tar

export MAX_BACK=1

++ export MAX_BACK=1

++ MAX_BACK=1



DEL_FILE=`cat $EXE_DIR/tmp_list | sort -n | head -1`

cat $EXE_DIR/tmp_list | sort -n | head -1

+++ cat /u01/backup/ftmcli-v2.4.3/tmp_list

+++ sort -n

+++ head -1

++ DEL_FILE=20210824



echo "******************************** $DEL_FILE ---------------------------"

++ echo '******************************** 20210824 ---------------------------'

******************************** 20210824 ---------------------------



DEL_FILE1=`$EXE_FTMCLI list $OBJ_STOR $PRO_FTMCLI | grep $DEL_FILE`

$EXE_FTMCLI list $OBJ_STOR $PRO_FTMCLI | grep $DEL_FILE

+++ java -jar /u01/backup/ftmcli-v2.4.3/ftmcli.jar list sagtprodapp01_backup --properties-file /u01/backup/ftmcli-v2.4.3/ftmcli.properties

+++ grep 20210824

++ DEL_FILE1=$'\rRUN_FS1_EBSAPPS_20210824.tar'





echo "************************ $DEL_FILE1 ----------------------------"

RUN_FS1_EBSAPPS_20210824.tar ----------------------------'

RUN_FS1_EBSAPPS_20210824.tar ----------------------------What is causing this behaviour. One thing that I noticed was

++ DEL_FILE1=$'\rRUN_FS1_EBSAPPS_20210824.tar

$'\r this is the couse of my agony, why is he putting careg return? How to get rid of it?

Thank you and Kind regardslatest?d=yIl2AUoC8zA latest?i=3EtO13bdNFQ:n5zcZVMgOgc:F7zBnMy latest?i=3EtO13bdNFQ:n5zcZVMgOgc:V_sGLiP latest?d=qj6IDK7rITs latest?i=3EtO13bdNFQ:n5zcZVMgOgc:gIN9vFw3EtO13bdNFQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments