Macros / variables in /usr/share/skel

So, /usr/share/skel, reporesents new user's home layout.
Now I add file /usr/share/skel/welcome

Is it possible to have macros / variables in /usr/share/skel/welcome file?

So for new user john, file welcome(txt file, NOT a script!), would be:
Code:
Welcome to the club john!
Your home dir is /usr/home/john
Derived from /usr/share/skel/welcome:
Code:
Welcome to the club $USER!
Your home dir is $HOME
 
Yes, but this file will be copied "as is" to the new user's home directory. Why not add it to .profile or something similar?
 
.profile is started when a (ba)sh shell starts. It's executed each time a user logs in. Similarly .cshrc is executed each time a user logs in with (t)csh.

Add commands to that to echo those lines. Something like

Code:
echo "Welcome $USER"
echo "Your home directory is $HOME"
 
Oh, I see.
That I knew, but was not a point.

Maybe example was too simple, as I just narrowed it.

Some text file, with some extension(if any), is dynamically created in user's home dir, when that user is created. (This means, only once in time, for that users)

Maybe it will be sh script, created based on it's template in skel, but customized for new user, eg $HOME path is diff, for each user.

Clearer now?
 
Yes, I understood what you meant. But for it to work you'd probably have to write your own adduser type tool.
 
Yes, there are absolutely many other methods.

But I am always, trying to do things at the lowest level possible.

So, here we can conclude that skel can't do this.
skel layout will always be blind carbon copy, "as is".
 
Back
Top