#1 Le 30/12/2016, à 09:52
- ubuntuforce
Faire lire un fichier de configuration a bash.
Salut les Ubuntueros,
Je cherche, pour une mon application qui lance bash ou l'interpréteur de votre choix, a faire lire a bash (pour le moment) un fichier ce configuration personnalisé.
J'ai bien sur chercher man bash, info bash, etc...
seulement je ne trouve pas le moyen de lui faire lire un fichier qui ne serai pas:
~/.bash_aliases
~/.bash_history
~/.bash_logout
~/.bashrc
ou les analogues dans /etc/....
---
Bref je ne veut pas qu'il faille ajouter le contenus de mon fichier de configuration personnalisé a un fichier que lis bash au lancement.
Et d'ailleurs je ne suis même pas sûr que bash le fasse ?
Que je le lance correctement autrement dit:
// [...]
char *argv_cmd[2] = {settings.user_shell, NULL} ;
/** Fork a new process: your default shell. **/
// The process is killed per example if you closing a terminals tab or by resetting the terminal else it is automatic by exiting the application.
// So we let no zoombies after us.
GPid child_pid ;
gchar **envp = g_get_environ() ;
vte_terminal_spawn_sync(VTE_TERMINAL(vteterminal),
VTE_PTY_DEFAULT,
settings.start_dir,
argv_cmd,
envp,
G_SPAWN_DEFAULT, NULL, NULL, &child_pid, NULL, NULL);
g_strfreev(envp) ;
vte_terminal_watch_child(VTE_TERMINAL(vteterminal), child_pid) ;
// [...]
J'ai par exemple essayer de faire:
char *argv_cmd[4] = {settings.user_shell, "-o", "history", NULL} ;
Afin que l'historique soit disponible dans mon (vte) terminal.
Mais cela ne marche pas, même en passant G_SPAWN_FILE_AND_ARGV_ZERO comme flag.
---
Toute aide est bien sur la bienvenue.
Merci pour votre aide et vos réponses éclairées.
PS: Je ne désire pas que passer "bash -o history" comme option, je pense aussi définir des alias aussi, etc...
Rendez-vous sur mon site présentant mes créations open-source: http://www.open-source-projects.net/
Rendez-vous sur mon site dédier a mes créations d'imagerie 3D: http://www.3dreaming-imaging.net/
Testez pendant une semaine l'éditeur avec terminaux intégrées http://www.open-source-projects.net/it-edit/it-edit Vous l'adopterai sûrement !
Hors ligne
#2 Le 30/12/2016, à 12:54
- J5012
Re : Faire lire un fichier de configuration a bash.
man bash
--noprofile
Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile. By default, bash reads these files when it is invoked as a login shell (see INVOCATION below).
--norc
Do not read and execute the system wide initialization file /etc/bash.bashrc and the personal initialization file ~/.bashrc if the shell is interactive. This option is on by default if the shell is invoked as sh.
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.
This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.
Hors ligne
#3 Le 01/01/2017, à 08:19
- ubuntuforce
Re : Faire lire un fichier de configuration a bash.
Merci !
Rendez-vous sur mon site présentant mes créations open-source: http://www.open-source-projects.net/
Rendez-vous sur mon site dédier a mes créations d'imagerie 3D: http://www.3dreaming-imaging.net/
Testez pendant une semaine l'éditeur avec terminaux intégrées http://www.open-source-projects.net/it-edit/it-edit Vous l'adopterai sûrement !
Hors ligne