53

Is Bash shell scripting case sensitive?

Is variable date the same as DATE?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mario
  • 2,303
  • 5
  • 20
  • 21
  • 5
    You could just try setting both and see if they remain distinct. – chepner Mar 22 '13 at 13:47
  • 6
    date, Date, dAte, DAte, daTe, DaTe, dATe, DATe, datE, DatE, dAtE, DAtE, daTE, DaTE, dATE, DATE are all different variables ;) – anishsane Mar 22 '13 at 14:21
  • 5
    Why did this get down-voted? The question is a bit ambiguous indeed but it's acceptable for someone new to BASH. – Pithikos Aug 28 '14 at 10:03
  • 1
    It's not a real question because simply trying it would have been quicker than phrasing it ... @Pithikos – tink Nov 16 '17 at 16:22
  • 5
    The fact that someone can verify this immediately having bash doesn't mean that this question is not valid. – kubal5003 Nov 16 '17 at 16:34
  • It *must* have been a duplicate already in 2013 (nearly 4 years after the launch of Stack Overflow). – Peter Mortensen Apr 24 '22 at 19:05

1 Answers1

68

Yes, it is case sensitive, just like the rest of UNIX. $date and $DATE are two different variables. makefile and Makefile are two different files. -h and -H are two distinct flags (usually).

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • 17
    Rather, `-h` and `-H` are always distinct, but may be interpreted identically by the program that accepts them. – chepner Mar 22 '13 at 13:46
  • macOS's (and maybe Windows's?) [filesystem is case-insensitive](https://en.wikipedia.org/wiki/Case_sensitivity#In_filesystems) so `makefile` and `Makefile` are the same file there. – Boris Verkhovskiy Jan 12 '23 at 22:03