3

I am trying to concatenate asterisks (*) to a string variable. However, I keep getting the files in the current directory instead. I have tried

row+='*'
row+=$row     #where row is *
row='*'"$row"
row="\*$row"
row="${row}*"

etc.

row='*'."$row"  #produces *.*.*. 

I thought \ would escape the *, but it didn't work.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Gary
  • 105
  • 1
  • 11
  • Thanks for the help. I kept searching for concatenating * and never for just printing them. – Gary Feb 24 '16 at 03:06

1 Answers1

0

Try using quotes around the variable before you "print".

For example:

cronSen="*/$a * * * * bash /etc/init.d/ckDskCheck.sh"
echo "$cronSen"

This could work. I got the idea from here: Printing asterisk (*) in bash shell

Community
  • 1
  • 1
Og Ramos
  • 46
  • 1
  • 9