LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-01-2013, 03:47 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Rep: Reputation: 51
Anyone familiar with splitvt?


Hi: when I run splitvt (with no options) I see that I loose some of the environment variables, namely: ls -l in my system prints the date as numbers (e.g., 2013-02-17). Within splitvt, it displays the month as a name, 'jun' for example. Also, the aliases are lost. In the man page there are listed the options, which are only a few, but I do not see a way to preserve the environment.

The shell is the same as when outside splitvt: bash. But the instances of bash launched by splitvt do not inherit the environment. I'll see in the /etc scripts if the ls options are exported or not. Any particular file to look for those options? Specially that which governs the date format.
 
Old 06-01-2013, 04:04 AM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 3,776

Rep: Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847
maybe not the answer you need, but for that I use the splitting functionality of tmux (libevent is the only dependency not already in Slackware, both are on SBo).
it has substituted screen on my installs and I've never looked back since.

side note: if you want to use it with "ctrl-a" like screen, you need just a minimal ~/.tmux.conf
Code:
set -g prefix C-a
(but be aware that in this way "ctrl-a a" -to go at the beginning of the line- won't work -in screen it does)

Last edited by ponce; 06-01-2013 at 04:19 AM.
 
Old 06-01-2013, 04:18 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
Thanks, I'll investigate the advantage of usin tmux. For the moment, the offending variable seems to be LS_OPTIONS. This variable is set and exported in /etc/profile.d/coreutils-dircolors.sh. The ls man page does not mention any environment variable that governs its behavior.

In fact, what happens is that 'ls', in that script, is aliased so:

alias ls='/bin/ls $LS_OPTIONS --time-style=long-iso'

splitvt, or any other utility for that matter, does not inherit the aliases, in particular this one, time-style is given the value long-iso. I wonder if it inherits (this is slackware 14.0 x86_64) the $LS_OPTIONS, which the script exports. If it does, then I could include the time-style option within LS_OPTIONS.

However I really do not know who uses this variable. What is it purpose? Do you know?
 
Old 06-01-2013, 04:40 AM   #4
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 3,776

Rep: Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847
the answer is written at the beginning of /etc/profile.d/coreutils-dircolors.sh (the options set there apply to the ls command already, as it's aliased)
 
Old 06-01-2013, 05:02 AM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
I see ...! Its only purpose is to build (or set) the alias. It is NOT used outside the script. And yet, why is it exported?

Anyways, splitvt starts bash as a non login shell, and then bash does not execute the /etc/profile.d/ scripts. I assume I could place the necesssary stuff in ~/.bashrc. But is there not a way to set things up for non login shells in a system wide way?
 
Old 06-01-2013, 05:17 AM   #6
GazL
Senior Member
 
Registered: May 2008
Posts: 4,408
Blog Entries: 7

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
Quote:
Originally Posted by stf92 View Post
I see ...! Its only purpose is to build (or set) the alias. It is NOT used outside the script. And yet, why is it exported?
No, you're still not understanding it. Notice the use of single-quotes on the alias definition: $LS_OPTIONS will be treated as a literal and only expanded when you actually use the alias. If they had been double-quotes then your above statement would have been correct.

Last edited by GazL; 06-01-2013 at 05:20 AM.
 
Old 06-01-2013, 05:38 AM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
I do not see any relevant difference. LS_OPTIONS is not used outside the script that sets it. This is the fact that took me so long to understand. Hummm...

When I type 'ls', the shell gets 'ls $LS_OPTIONS et cetera'. It then substitutes the variable value, and everything happens as if i had typed 'ls -F -b -T 0 color=never etcetera'. So, I was wrong. LS_OPTIONS _is_ used outside the script! It is used by bash.

In view of my other thread on the more specific question of shell scripts and non login shells is not getting any feedback (holy impatience), I'll tell you the following, guys:

splitvt launches non login shells. Therefor, bash does not read the /etc/profile.d/ scripts when when called by splitvt. And therefor I lack the ls alias, so carefully set by coreutils-dircolors.sh.

My solution: I wrote the following ~/.bashrc:
Code:
OPTIONS="-F -b -T 0"
COLOR=never
LS_OPTIONS="$OPTIONS --color=$COLOR";
export LS_OPTIONS;
alias ls='/bin/ls $LS_OPTIONS --time-style=long-iso'
And voilą. Still it's only provisional, as I intend to make this behavior for non login shells system wide. But in order to do that I will have to read some 10000 lines of the bash man page, to find where it speaks about login/non login shells and interactive/non interactive shells (perhaps some strokes of the slash key will help).

Last edited by stf92; 06-01-2013 at 05:52 AM.
 
Old 06-01-2013, 01:23 PM   #8
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,366

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
Slackware's bash is not compiled to support a global /etc/bashrc (or /etc/bash.bashrc) so you could either add a default .bashrc in /etc/skel that gets copied to a new user's home directory upon account creation or recompile bash to enable global bashrc support. If you do want to recompile bash, then adding the following to the CFLAGS variable in the SlackBuild should work (though I haven't tried this):
Code:
-DSYS_BASHRC=/etc/bash.bashrc
(There may be some quoting issues so you may need to surround /etc/bash.bashrc with \" but again I haven't tried it.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone familiar with Qt? jimroach Linux - Newbie 3 09-25-2007 08:11 PM
Not that Familiar with rsync ryanlum Linux - Software 2 07-29-2007 03:18 AM
Any using or familiar with glfer? alvez Linux - Software 0 01-22-2006 09:05 AM
Is anyone familiar with ksplash/ml? maestro52 Linux - Software 0 08-25-2003 05:33 PM
Anyone here familiar with ClarkConnect? KungFuHamster Linux - Networking 1 02-13-2003 09:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration