0

I want to write the script to read the file name in below format.

filename.wednesday filename.thursday filename.friday

I am using below command but still print the weekday in an Uppercase letter.

Wednesday, Thursday, Friday 

May I know how can convert it to lowercase so that able to read the file?

kvantour
  • 25,269
  • 4
  • 47
  • 72
snowman0805
  • 41
  • 1
  • 3
  • 7
  • filename.wednesday filename.thursday filename.friday – snowman0805 Oct 18 '18 at 02:54
  • enter code here dd="$(date +'%A')" DD=$(echo "$dd" | awk '{print tolower($0)}') echo "$DD" >>$outputlog echo "tail filename.$DD">>$outputlog – snowman0805 Oct 18 '18 at 02:54
  • Use : typeset -l dd . Anything put in that variable will be converted to lowercase. – Andre Gelinas Oct 18 '18 at 03:00
  • tried . But it print null output. Because my variable in weekday format as below. dd="$(date +'%A')" . Want make it into lower case – snowman0805 Oct 18 '18 at 03:30
  • 1
    Sorry, but your question is unclear. We do not know how you generate those filenames. You talk about a below command, but where is it? – kvantour Oct 18 '18 at 07:48
  • Possible duplicate of [How to convert a string to lower case in Bash?](https://stackoverflow.com/questions/2264428/how-to-convert-a-string-to-lower-case-in-bash) – kvantour Oct 18 '18 at 07:49
  • @snowman0805 Which version of bash are you using ?, both your code and my suggestion works on my linux, using Bash 4.1.2 – Andre Gelinas Oct 18 '18 at 11:17
  • @snowman0805, I think you were missing quotes. Try this: dd="$(date +'%A')"; DD="$(echo "$dd" | awk '{print tolower($0)}')"; echo "$DD" – flu Oct 18 '18 at 14:03
  • wrt `below command` - you don't have a command in your question. If you have code then add it to your question. See [ask]. – Ed Morton Oct 18 '18 at 14:35

0 Answers0