Is there really a Bug in ls -l not observing the Environment Variable TIME_STYLE? [duplicate]












0















This question already has an answer here:




  • How do I set environment variables?

    6 answers



  • How do I add environment variables?

    5 answers




Look at this: I want to let ls- l always show the date formatted as long-iso. I was told to add a file /etc/profile.local with the line export TIME_STYLE=long-iso. I did so, as shown below under #1.



However, there is no environment variable TIME_STYLE as shown in #2.



#3 shows the version of the ls command (this all happens with Xubuntu 16.04 LTS).



As shown in the output of #4, ls does not format the date part as long-iso.



Ok, if it is just because the environment variable TIME_STYLE is missing (why?), then I set it in #5 and, as a proof that it exists, I echo it in #6.



Despite of that, ls -l in #7 does not honour that!



Of course, if I explicitly require the date format as long iso as shown in #8, the date is formatted that way. But I want to let ls -l always show the date as long-iso without having to tell it on every invocation and I also want to avoid to create an alias for ls -l which incorporates this parameter (which of course would be easy to do, but that's not sportsmanlike).



What's wrong here? Some basic misunderstanding? Or is it really a bug? I can't really believe it in ls -l!



a@v:~$ cat /etc/profile.local                 # 1
export TIME_STYLE=long-iso
a@v:~$ echo "${TIME_STYLE}" # 2

a@v:~$ ls --version # 3
ls (GNU coreutils) 8.25
...
a@v:~$ ls -l /etc/profile.local # 4
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ TIME_STYLE=long-iso # 5
a@v:~$ echo "${TIME_STYLE}" # 6
long-iso
a@v:~$ ls -l /etc/profile.local # 7
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ ls -l --time-style="${TIME_STYLE}" /etc/profile.local # 8
-rw-r--r-- 1 root root 27 2018-12-30 19:18 /etc/profile.local
a@v:~$


Edit: As dessert taught us: After using sudo nano to append a line export TIME_STYLE=long-iso to the existing file /etc/bash.bashrc I got:



a@v:~$ ls -l /etc/bash.bashrc
-rw-r--r-- 1 root root 2374 2019-01-02 00:23 /etc/bash.bashrc
a@v:~$



Thank you, dessert, for your help and especially for your explanations why ls -l did not work as intended.










share|improve this question















marked as duplicate by dessert command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 10:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
    – dessert
    Dec 31 '18 at 10:45












  • /etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
    – dessert
    Dec 31 '18 at 10:59








  • 1




    You need to export the variable because ls is an external program rather than a shell builtin.
    – dessert
    Dec 31 '18 at 11:05
















0















This question already has an answer here:




  • How do I set environment variables?

    6 answers



  • How do I add environment variables?

    5 answers




Look at this: I want to let ls- l always show the date formatted as long-iso. I was told to add a file /etc/profile.local with the line export TIME_STYLE=long-iso. I did so, as shown below under #1.



However, there is no environment variable TIME_STYLE as shown in #2.



#3 shows the version of the ls command (this all happens with Xubuntu 16.04 LTS).



As shown in the output of #4, ls does not format the date part as long-iso.



Ok, if it is just because the environment variable TIME_STYLE is missing (why?), then I set it in #5 and, as a proof that it exists, I echo it in #6.



Despite of that, ls -l in #7 does not honour that!



Of course, if I explicitly require the date format as long iso as shown in #8, the date is formatted that way. But I want to let ls -l always show the date as long-iso without having to tell it on every invocation and I also want to avoid to create an alias for ls -l which incorporates this parameter (which of course would be easy to do, but that's not sportsmanlike).



What's wrong here? Some basic misunderstanding? Or is it really a bug? I can't really believe it in ls -l!



a@v:~$ cat /etc/profile.local                 # 1
export TIME_STYLE=long-iso
a@v:~$ echo "${TIME_STYLE}" # 2

a@v:~$ ls --version # 3
ls (GNU coreutils) 8.25
...
a@v:~$ ls -l /etc/profile.local # 4
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ TIME_STYLE=long-iso # 5
a@v:~$ echo "${TIME_STYLE}" # 6
long-iso
a@v:~$ ls -l /etc/profile.local # 7
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ ls -l --time-style="${TIME_STYLE}" /etc/profile.local # 8
-rw-r--r-- 1 root root 27 2018-12-30 19:18 /etc/profile.local
a@v:~$


Edit: As dessert taught us: After using sudo nano to append a line export TIME_STYLE=long-iso to the existing file /etc/bash.bashrc I got:



a@v:~$ ls -l /etc/bash.bashrc
-rw-r--r-- 1 root root 2374 2019-01-02 00:23 /etc/bash.bashrc
a@v:~$



Thank you, dessert, for your help and especially for your explanations why ls -l did not work as intended.










share|improve this question















marked as duplicate by dessert command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 10:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
    – dessert
    Dec 31 '18 at 10:45












  • /etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
    – dessert
    Dec 31 '18 at 10:59








  • 1




    You need to export the variable because ls is an external program rather than a shell builtin.
    – dessert
    Dec 31 '18 at 11:05














0












0








0








This question already has an answer here:




  • How do I set environment variables?

    6 answers



  • How do I add environment variables?

    5 answers




Look at this: I want to let ls- l always show the date formatted as long-iso. I was told to add a file /etc/profile.local with the line export TIME_STYLE=long-iso. I did so, as shown below under #1.



However, there is no environment variable TIME_STYLE as shown in #2.



#3 shows the version of the ls command (this all happens with Xubuntu 16.04 LTS).



As shown in the output of #4, ls does not format the date part as long-iso.



Ok, if it is just because the environment variable TIME_STYLE is missing (why?), then I set it in #5 and, as a proof that it exists, I echo it in #6.



Despite of that, ls -l in #7 does not honour that!



Of course, if I explicitly require the date format as long iso as shown in #8, the date is formatted that way. But I want to let ls -l always show the date as long-iso without having to tell it on every invocation and I also want to avoid to create an alias for ls -l which incorporates this parameter (which of course would be easy to do, but that's not sportsmanlike).



What's wrong here? Some basic misunderstanding? Or is it really a bug? I can't really believe it in ls -l!



a@v:~$ cat /etc/profile.local                 # 1
export TIME_STYLE=long-iso
a@v:~$ echo "${TIME_STYLE}" # 2

a@v:~$ ls --version # 3
ls (GNU coreutils) 8.25
...
a@v:~$ ls -l /etc/profile.local # 4
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ TIME_STYLE=long-iso # 5
a@v:~$ echo "${TIME_STYLE}" # 6
long-iso
a@v:~$ ls -l /etc/profile.local # 7
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ ls -l --time-style="${TIME_STYLE}" /etc/profile.local # 8
-rw-r--r-- 1 root root 27 2018-12-30 19:18 /etc/profile.local
a@v:~$


Edit: As dessert taught us: After using sudo nano to append a line export TIME_STYLE=long-iso to the existing file /etc/bash.bashrc I got:



a@v:~$ ls -l /etc/bash.bashrc
-rw-r--r-- 1 root root 2374 2019-01-02 00:23 /etc/bash.bashrc
a@v:~$



Thank you, dessert, for your help and especially for your explanations why ls -l did not work as intended.










share|improve this question
















This question already has an answer here:




  • How do I set environment variables?

    6 answers



  • How do I add environment variables?

    5 answers




Look at this: I want to let ls- l always show the date formatted as long-iso. I was told to add a file /etc/profile.local with the line export TIME_STYLE=long-iso. I did so, as shown below under #1.



However, there is no environment variable TIME_STYLE as shown in #2.



#3 shows the version of the ls command (this all happens with Xubuntu 16.04 LTS).



As shown in the output of #4, ls does not format the date part as long-iso.



Ok, if it is just because the environment variable TIME_STYLE is missing (why?), then I set it in #5 and, as a proof that it exists, I echo it in #6.



Despite of that, ls -l in #7 does not honour that!



Of course, if I explicitly require the date format as long iso as shown in #8, the date is formatted that way. But I want to let ls -l always show the date as long-iso without having to tell it on every invocation and I also want to avoid to create an alias for ls -l which incorporates this parameter (which of course would be easy to do, but that's not sportsmanlike).



What's wrong here? Some basic misunderstanding? Or is it really a bug? I can't really believe it in ls -l!



a@v:~$ cat /etc/profile.local                 # 1
export TIME_STYLE=long-iso
a@v:~$ echo "${TIME_STYLE}" # 2

a@v:~$ ls --version # 3
ls (GNU coreutils) 8.25
...
a@v:~$ ls -l /etc/profile.local # 4
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ TIME_STYLE=long-iso # 5
a@v:~$ echo "${TIME_STYLE}" # 6
long-iso
a@v:~$ ls -l /etc/profile.local # 7
-rw-r--r-- 1 root root 27 Dez 30 19:18 /etc/profile.local
a@v:~$ ls -l --time-style="${TIME_STYLE}" /etc/profile.local # 8
-rw-r--r-- 1 root root 27 2018-12-30 19:18 /etc/profile.local
a@v:~$


Edit: As dessert taught us: After using sudo nano to append a line export TIME_STYLE=long-iso to the existing file /etc/bash.bashrc I got:



a@v:~$ ls -l /etc/bash.bashrc
-rw-r--r-- 1 root root 2374 2019-01-02 00:23 /etc/bash.bashrc
a@v:~$



Thank you, dessert, for your help and especially for your explanations why ls -l did not work as intended.





This question already has an answer here:




  • How do I set environment variables?

    6 answers



  • How do I add environment variables?

    5 answers








command-line bash ls






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 7:38

























asked Dec 31 '18 at 10:35









Adalbert Hanßen

1215




1215




marked as duplicate by dessert command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 10:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by dessert command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 31 '18 at 10:44


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
    – dessert
    Dec 31 '18 at 10:45












  • /etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
    – dessert
    Dec 31 '18 at 10:59








  • 1




    You need to export the variable because ls is an external program rather than a shell builtin.
    – dessert
    Dec 31 '18 at 11:05


















  • You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
    – dessert
    Dec 31 '18 at 10:45












  • /etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
    – dessert
    Dec 31 '18 at 10:59








  • 1




    You need to export the variable because ls is an external program rather than a shell builtin.
    – dessert
    Dec 31 '18 at 11:05
















You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
– dessert
Dec 31 '18 at 10:45






You forgot to export the variable, TIME_STYLE=long-iso ls -l as well as export TIME_STYLE=long-iso; ls -l both work as expected.
– dessert
Dec 31 '18 at 10:45














/etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
– dessert
Dec 31 '18 at 10:59






/etc/profile.local is not recognized by bash, see man bash/INVOCATION. Add the export line to either /etc/bash.bashrc or preferably your ~/.bashrc and it will be read by every new bash interactive shell.
– dessert
Dec 31 '18 at 10:59






1




1




You need to export the variable because ls is an external program rather than a shell builtin.
– dessert
Dec 31 '18 at 11:05




You need to export the variable because ls is an external program rather than a shell builtin.
– dessert
Dec 31 '18 at 11:05










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg