Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2510 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Divers

  vos plus beaux prompts

 


 Mot :   Pseudo :  
 
 Page :   1  2
Page Précédente
Auteur Sujet :

vos plus beaux prompts

n°746412
o-0-o
Posté le 29-10-2005 à 22:35:14  profilanswer
 

pour tous ceux qui restent persuadés que l'interface graphique ne peut remplacer la ligne de commande, un beau prompt peut embellir ce qu'on fait dans notre console.
faites donc profiter de vos plus beaux prompts :)


---------------
pouet !
mood
Publicité
Posté le 29-10-2005 à 22:35:14  profilanswer
 

n°746415
l0ky
Posté le 29-10-2005 à 22:51:48  profilanswer
 

$


#


[:pingouino]

n°746417
Taz
bisounours-codeur
Posté le 29-10-2005 à 23:06:31  profilanswer
 

http://dejean.benoit.free.fr/img/shell.png
 
extrait de mon bashrc :

Code :
  1. TTY=$(tty)
  2. echo -n $TTY | grep ^/dev/ > /dev/null
  3. if [[ $? == 0 ]]; then
  4.     TTY=$(echo -n $TTY | tail -c +6)
  5. fi;
  6.    
  7. function my_prompt_command()
  8.  {
  9.     EXIT_CODE=$?
  10.      BATT=$(~/bin/batt)
  11.     JOBS=$(jobs | wc -l)
  12.     if [ $EXIT_CODE -ne 0 ]
  13.  then
  14.  CODE_STRING="\[\e[0;31m\]? ${EXIT_CODE}\[\e[0m\]"
  15.     else
  16.  CODE_STRING=""
  17.     fi
  18.     if [ $JOBS -ne 0 ]
  19.  then
  20.  JOBS_STRING="\[\e[33m\][&\j]\[\e[0m\]"
  21.     else
  22.  JOBS_STRING=""
  23.     fi
  24.     PS1="\n\[\e[0;35m\][\t]\[\e[0m\]${BATT}\[\e[0;34m\][${TTY}]\[\e[0m\]\[\e[0;32m\][\w]\[\e[0m\]\[\e[36m\][#\#]\[\e[0m\]${JOBS_STRING} ${CODE_STRING}\n\u\[\e[0;33m\]@\[\e[0m\]\[\e[4m\]\h\[\e[0m\] \[\e[1;32m\]>>>\[\e[0m\] "
  25.  }
  26. PROMPT_COMMAND=my_prompt_command
  27. PS2="\[\e[1;32m\]...\[\e[0m\]  "


 
et le code de ~/bin/batt. Ne fonctionne a priori que sur ppc. Je l'ai torché en C pour pas que ça prenne 3 plombes à chaque ls.

Code :
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #ifdef STARTSWITH
  5. # undef STARTSWITH
  6. #endif
  7. #define STARTSWITH(S, PREFIX) (strncmp(S, PREFIX, strlen(PREFIX)) == 0)
  8. static unsigned
  9. get_value(const char *line)
  10. {
  11. char *sep;
  12. sep = strchr(line, ':');
  13. if (!sep)
  14. {
  15.  fprintf(stderr, "bad line '%s'\n", line);
  16.  return 0;
  17. }
  18. return strtoul(sep + 1, NULL, 10);
  19. }
  20. static int
  21. is_on_ac_power(void)
  22. {
  23. FILE* f;
  24. char line[80];
  25. int state = 0;
  26. f = fopen("/proc/pmu/info", "r" );
  27. if (!f)
  28. {
  29.  perror("fopen" );
  30.  goto out;
  31. }
  32. while (fgets(line, sizeof line, f))
  33. {
  34.  if (STARTSWITH(line, "AC Power" ))
  35.  {
  36.   state = get_value(line);
  37.   break;
  38.  }
  39. }
  40. fclose(f);
  41. out:
  42. return state;
  43. }
  44. struct BatteryInfo
  45. {
  46. unsigned time;
  47. unsigned short cur;
  48. unsigned short max;
  49. };
  50. static struct BatteryInfo
  51. get_battery_info(unsigned which)
  52. {
  53. char path[80];
  54. char line[80];
  55. FILE* f;
  56. struct BatteryInfo batt = {0, 0, 0};
  57. snprintf(path, sizeof path, "/proc/pmu/battery_%u", which);
  58. f = fopen(path, "r" );
  59. if (!f)
  60. {
  61.  perror("fopen" );
  62.  goto out;
  63. }
  64. while (fgets(line, sizeof line, f))
  65. {
  66.  if (STARTSWITH(line, "charge" ))
  67.  {
  68.   batt.cur = get_value(line);
  69.  }
  70.  else if (STARTSWITH(line, "max_charge" ))
  71.  {
  72.   batt.max = get_value(line);
  73.  }
  74.  else if (STARTSWITH(line, "time rem." ))
  75.  {
  76.   batt.time = get_value(line);
  77.  }
  78. }
  79. fclose(f);
  80. out:
  81. return batt;
  82. }
  83. static unsigned
  84. get_cpufreq(unsigned which)
  85. {
  86. char path[256];
  87. unsigned freq = 0;
  88. FILE* f;
  89. snprintf(path, sizeof path,
  90.   "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq",
  91.   which);
  92. f = fopen(path, "r" );
  93. if (!f)
  94. {
  95.  perror("fopen" );
  96.  goto out;
  97. }
  98. fscanf(f, "%u", &freq);
  99. fclose(f);
  100. out:
  101. return freq;
  102. }
  103. int
  104. main()
  105. {
  106. struct BatteryInfo batt;
  107. unsigned percentage;
  108. unsigned state;
  109. batt = get_battery_info(0);
  110. percentage = batt.cur * 100 / batt.max;
  111. state = is_on_ac_power();
  112. if (state && percentage > 90)
  113.  return 0;
  114. putchar('(');
  115. printf("%s %d%%",
  116.        (state ? "AC" : "Batt." ),
  117.        percentage);
  118. if (!state)
  119. {
  120.  unsigned hours, minutes;
  121.  unsigned freq;
  122.  div_t d;
  123.  d = div(batt.time, 3600);
  124.  hours = d.quot;
  125.  minutes = d.rem / 60;
  126.  freq = get_cpufreq(0) / 1000;
  127.  printf(" - %u:%02u - %uMHz",
  128.         hours,
  129.         minutes,
  130.         freq);
  131. }
  132. putchar(')');
  133. return 0;
  134. }


Message cité 1 fois
Message édité par Taz le 29-10-2005 à 23:21:25
n°746420
o-0-o
Posté le 29-10-2005 à 23:10:13  profilanswer
 

merci :-)  
 
le mien avec zsh :
http://membres.lycos.fr/ph4l3n3/prompt.png
 
 
code :
 
 
 
autoload -U colors
colors
bleu_color="blue"
rouge_color="red"
user_color="%{$fg[$bleu_color]%}"
root_color="%{$fg[$rouge_color]%}"
end="%{$reset_color%}"
 
[[ -z $USER ]] && USER=$LOGNAME          # Va savoir pourquoi, yapa $USER
case $USER in
        root)
#Prompt root par défaut        
PROMPT="${root_color}-=[${end}%n@%m${root_color}]=%0(?..<${end}Failed %?${root_color}>=)(${end}%9(c!...!)%8c${root_color})%(#.#
.> ) $end"    # default prompt
#Prompt Droit
#RPROMPT="${root_color}<(${end}%*${root_color})>${end}"                  # Prompt droit
        ;;
        *)
PROMPT="${user_color}[${end}%n@%m${user_color}]-%0(?..<${end}Failed %?${user_color}>-)(${end}%9(c!...!)%8c${user_color})%(#.#.>
) $end"    # default prompt
#Prompt Droit
#RPROMPT="${user_color}<(${end}%*${user_color})>${end}"                  # Prompt droit
        ;;


Message édité par o-0-o le 29-10-2005 à 23:11:05

---------------
pouet !
n°746421
o-0-o
Posté le 29-10-2005 à 23:11:47  profilanswer
 

Taz : tu utilise quel shell ? tu pourrais donner le code ?
merci :-)


---------------
pouet !
n°746424
sebchap
Share the knowledge
Posté le 29-10-2005 à 23:27:36  profilanswer
 

http://img492.imageshack.us/img492/8962/prompt5bu.png
le shell c'est zsh :)


Message édité par sebchap le 29-10-2005 à 23:28:16

---------------
BOFH excuse #400:We are Microsoft.  What you are experiencing is not a problem; it is an undocumented feature.
n°746426
Taz
bisounours-codeur
Posté le 29-10-2005 à 23:29:31  profilanswer
 

j'ai maj

n°747123
o-0-o
Posté le 31-10-2005 à 22:21:18  profilanswer
 

up pour des prompts à faire envie
:-)

n°747302
black_lord
Modérateur
Truth speaks from peacefulness
Posté le 01-11-2005 à 13:50:25  profilanswer
 


[nico:~]  


 
[:petrus75]
 
PS : zsh pawa :o


Message édité par black_lord le 01-11-2005 à 13:50:34

---------------
uptime is for lousy system administrators what Viagra is for impotent people - mes unixeries - github me
n°747303
Profil sup​primé
Posté le 01-11-2005 à 13:53:02  answer
 


[02:32   keymaker@alastor:~]
-->  


 
edit : mince, y'a pas les couleurs


Message édité par Profil supprimé le 01-11-2005 à 13:53:25
mood
Publicité
Posté le 01-11-2005 à 13:53:02  profilanswer
 

n°747306
Profil sup​primé
Posté le 01-11-2005 à 13:56:52  answer
 
n°747730
o-0-o
Posté le 02-11-2005 à 12:59:44  profilanswer
 

n'hésitez pas a mettre quels sont vos shells et les codes !

n°747812
gambas
Posté le 02-11-2005 à 16:40:43  profilanswer
 

http://img73.imageshack.us/img73/7659/prompt8wh.png
et le "code" ...

Code :
  1. function cprompt {
  2.         Nvert=$'%{\e[0;32m%}'
  3.         Bvert=$'%{\e[1;32m%}'
  4.         Nblanc=$'%{\e[0;37m%}'
  5.         Bblanc=$'%{\e[1;37m%}'
  6.         Nrouge=$'%{\e[0;31m%}'
  7.         Brouge=$'%{\e[1;31m%}'
  8.         Njaune=$'%{\e[0;33m%}'
  9.         Bjaune=$'%{\e[1;33m%}'
  10.         export PS1="$Nblanc.:: $Nvert%n@$Bblanc%M$Nblanc ::. .::$Nrouge Err: $Bblanc%?$Nblanc ::. .::$Njaune %~ $Nblanc::.
  11. $"
  12. }


---------------
.:: the greater pain that they endure, the more you know the show has scored ... its showtime ::.
n°747977
o-0-o
Posté le 02-11-2005 à 21:32:22  profilanswer
 

joli :)

n°750816
o-0-o
Posté le 10-11-2005 à 15:32:58  profilanswer
 

:-)

n°754355
o-0-o
Posté le 20-11-2005 à 20:27:00  profilanswer
 

ca motive pas les masses dites moi


---------------
pouet !
n°756068
o-0-o
Posté le 25-11-2005 à 21:31:35  profilanswer
 
n°756096
black_lord
Modérateur
Truth speaks from peacefulness
Posté le 25-11-2005 à 23:19:01  profilanswer
 

sympa le premier lien, je me suis bidouillé une fonction de completion pour zsh :o


---------------
uptime is for lousy system administrators what Viagra is for impotent people - mes unixeries - github me
n°756100
sebchap
Share the knowledge
Posté le 25-11-2005 à 23:30:00  profilanswer
 

Il y a aussi zsh lover
http://grml.org/zsh/


---------------
BOFH excuse #400:We are Microsoft.  What you are experiencing is not a problem; it is an undocumented feature.
n°756146
cycojesus
Mèo Lười
Posté le 26-11-2005 à 10:58:50  profilanswer
 

j'ai refais mon prompt dans un élan d'ennui :

[16:56][2005/novembre/26]$ echo $PS1
%{^[[00;36;40m%}[%T][%3~]%{^[[01;32;40m%}%(!.#.$)%{^[[0m%}



---------------
Chết rồi ! ✍ ⌥⌘ http://codeberg.org/gwh
n°756158
Riot
Buy me a riot
Posté le 26-11-2005 à 11:39:30  profilanswer
 

Fallait le dire que ce topic était réservé aux zsh-users :/

n°756164
sebchap
Share the knowledge
Posté le 26-11-2005 à 11:54:22  profilanswer
 

C'est un très bon shell donc bcp de monde l'utilise. Rien ne t'empeche de poster ton prompt bash, csh etc... en nous donnant tes conseils [:spamafote]


---------------
BOFH excuse #400:We are Microsoft.  What you are experiencing is not a problem; it is an undocumented feature.
n°756306
o-0-o
Posté le 26-11-2005 à 20:05:35  profilanswer
 

tout à fait :-)  
je donne des liens zsh, car c'est ce que j'utilise, mais le topic est ouvert à tous les shells !


---------------
pouet !
n°756366
mardi_soir
Posté le 27-11-2005 à 01:21:11  profilanswer
 

un truc chopé je ne sais plus ou (ce n'est pas de moi donc)
 
PS1="\n\[\033[35m\]\$(/bin/date)\n\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\]"

n°756367
mardi_soir
Posté le 27-11-2005 à 01:22:34  profilanswer
 

merde le smiley  lire /bin/sed -e 's: /dev/::')
                                             sans espace entre s: et /dev

n°756376
o-0-o
Posté le 27-11-2005 à 02:05:42  profilanswer
 
n°763497
o-0-o
Posté le 18-12-2005 à 20:53:10  profilanswer
 

http://membres.lycos.fr/ph4l3n3/prompt2.png
 
## set prompts ####
## choose just one
#PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%{\e[0;31m%}%3~%{\e[0m%}%# ' ## user:~%
#PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%{\e[0;31m%}%3~%{\e[0m%}%B>%b ' ## user:~>
#PS1='%n@%m:%4c%1v> ';RPS1=$'%{\e[0;36m%}%D{%A %T}%{\e[0m%}' ## user@host:~> ; D
ay time(hh:mm:ss)
#PS1='%B[%b%n%B:%b%~%B]%b$ ' ## [user:~]$
#PS1=$'%{\e[0;36m%}%n%{\e[0m%}:%20<..<%~%B>%b ' ## user:..c/vim-common-6.0>
#PS1=$'%{\e[0;36m%}%#%{\e[0m%} ';RPS1=$'%{\e[0;31m%}%~%{\e[0m%}' ## % ; ~
#PS1=$'%{\e[0;36m%}%n%{\e[0m%}%{\e[0;31m%}%#%{\e[0m%} ';RPS1=$'%{\e[0;31m%}%~%{\
e[0m%}' ## user% ; ~
#PS1='%# ';RPS1='%B%~%b' ## % ; ~ : no colors
#PS1='%n@%m:%B%~%b> ' ## user@host:~> : no colors
 
## or use neat prompt themes included with zsh
autoload -U promptinit
promptinit
## Currently available prompt themes:
## adam1 adam2 bart bigfade clint elite2 elite
## fade fire off oliver redhat suse walters zefram
prompt clint


---------------
pouet !
n°806087
Photonium
Masse atomique : 0 uma
Posté le 30-04-2006 à 15:20:05  profilanswer
 

Bonjour,

Taz a écrit :


...
et le code de ~/bin/batt. Ne fonctionne a priori que sur ppc. Je l'ai torché en C pour pas que ça prenne 3 plombes à chaque ls.


 
Je l'ai hacké pour qu'il marche chez moi sur un centrino (donc i386). le voici :
 

Code :
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #ifdef STARTSWITH
  5. # undef STARTSWITH
  6. #endif
  7. #define STARTSWITH(S, PREFIX) (strncmp(S, PREFIX, strlen(PREFIX)) == 0)
  8. static unsigned
  9. get_value(const char *line)
  10. {
  11.   char *sep;
  12.    
  13.   sep = strchr(line, ':');
  14.  
  15.   if (!sep)
  16.     {
  17.       fprintf(stderr, "bad line '%s'n", line);
  18.       return 0;
  19.     }
  20.  
  21.   if ((int)strstr(sep,"on-line" ) || (int)strstr(sep,"yes" ))
  22.     return 1;
  23.  
  24.   return strtoul(sep + 1, NULL, 10);
  25. }
  26. static int
  27. is_on_ac_power(void)
  28. {
  29.   FILE* f;
  30.   char line[80];
  31.   int state = 0;
  32.  
  33.   f = fopen("/proc/acpi/ac_adapter/ACAD/state", "r" );
  34.  
  35.   if (!f)
  36.     {
  37.       //perror("fopen" );
  38.       printf("Error in opening /proc/acpi/ac_adapter/ACAD/state" );
  39.       goto out;
  40.     }
  41.  
  42.   while (fgets(line, sizeof line, f))
  43.     {
  44.       if (STARTSWITH(line, "state"/* AC Power"*/))
  45. {
  46.   state = get_value(line);
  47.   break;
  48. }
  49.     }
  50.  
  51.   fclose(f);
  52. out:
  53.   return state;
  54. }
  55. static int
  56. is_batt_present(unsigned which)
  57. {
  58.   FILE* f;
  59.   char line[80];
  60.   int state = 0;
  61.   char path[80];
  62.  
  63.   snprintf(path, sizeof path, "/proc/acpi/battery/BAT%u/state", which);
  64.  
  65.   f = fopen(path, "r" );
  66.  
  67.   if (!f)
  68.     {
  69.       //perror("fopen" );
  70.       printf("Error in opening /proc/acpi/battery/BAT%u/state" );
  71.       goto out;
  72.     }
  73.  
  74.   while (fgets(line, sizeof line, f))
  75.     {
  76.       if (STARTSWITH(line, "present"/* AC Power"*/))
  77. {
  78.   state = get_value(line);
  79.   break;
  80. }
  81.     }
  82.  
  83.   fclose(f);
  84. out:
  85.   return state;
  86. }
  87. struct BatteryInfo
  88. {
  89.   unsigned time;
  90.   unsigned short cur;
  91.   unsigned short max;
  92. };
  93. static struct BatteryInfo
  94. get_battery_info(unsigned which)
  95. {
  96.   char path[80];
  97.   char line[80];
  98.   FILE* f;
  99.   struct BatteryInfo batt = {0, 0, 0};
  100.  
  101.   snprintf(path, sizeof path, "/proc/acpi/battery/BAT%u/state", which);
  102.  
  103.   f = fopen(path, "r" );
  104.  
  105.   if (!f)
  106.     {
  107.       //perror("fopen" );
  108.       printf("Error in opening /proc/acpi/battery/BAT%u/state" );
  109.       goto out;
  110.     }
  111.  
  112.   while (fgets(line, sizeof line, f))
  113.     {
  114.       if (STARTSWITH(line, "remaining capacity" ))
  115. {
  116.   batt.cur = get_value(line);
  117. }
  118.       else if (STARTSWITH(line, "present rate" ))
  119. {
  120.   batt.time = get_value(line);
  121. }
  122.     }
  123.  
  124.   fclose(f);
  125.   snprintf(path, sizeof path, "/proc/acpi/battery/BAT%u/info", which);
  126.  
  127.   f = fopen(path, "r" );
  128.  
  129.   if (!f)
  130.     {
  131.       //perror("fopen" );
  132.       printf("Error in opening /proc/acpi/battery/BAT%u/info" );
  133.       goto out;
  134.     }
  135.  
  136.   while (fgets(line, sizeof line, f))
  137.     {
  138.       if (STARTSWITH(line, "last full capacity" ))
  139. batt.max = get_value(line);
  140.     }
  141. out:
  142.   return batt;
  143. }
  144.    
  145.    
  146. static unsigned
  147. get_cpufreq(unsigned which)
  148. {
  149.   char path[256];
  150.   unsigned freq = 0;
  151.   FILE* f;
  152.    
  153.   snprintf(path, sizeof path,
  154.    "/sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq",
  155.    which);
  156.    
  157.   f = fopen(path, "r" );
  158.    
  159.   if (!f)
  160.     {
  161.       //perror("fopen" );
  162.       printf("Error in opening /sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq" );
  163.       goto out;
  164.     }
  165.      
  166.   fscanf(f, "%u", &freq);
  167.   fclose(f);
  168. out:
  169.   return freq;
  170. }
  171.    
  172.    
  173. int
  174. main()
  175. {
  176.   struct BatteryInfo batt;
  177.   unsigned percentage;
  178.   unsigned state;
  179.   unsigned presence;
  180.    
  181.   batt = get_battery_info(1);
  182.    
  183.   state = is_on_ac_power();
  184.   presence = is_batt_present(1);
  185.   if (!presence)
  186.     return 0;
  187.   percentage = batt.cur * 100 / batt.max;
  188.   if (state && percentage > 90)
  189.     return 0;
  190.    
  191.   putchar('(');
  192.    
  193.   printf("%s %d%%",
  194.  (state ? "AC" : "Batt." ),
  195.  percentage);
  196.   if (!state)
  197.     {
  198.       unsigned hours, minutes;
  199.       unsigned freq;
  200.       div_t d;
  201.    
  202.       d = div(batt.time, 3600);
  203.       hours = d.quot;
  204.       minutes = d.rem / 60;
  205.    
  206.       freq = get_cpufreq(0) / 1000;
  207.    
  208.       printf(" - %u:%02u - %uMHz",
  209.      hours,
  210.      minutes,
  211.      freq);
  212.     }
  213.    
  214.   putchar(')');
  215.    
  216.   return 0;
  217. }


 
Certaines parties peuvent vous sembler dégueulasses et c'est surement parce qu'elles le sont :sarcastic: . Ca marche chez moi, donc je ferme les yeux. Si vous voulez les améliorer, ne vous génez pas.  
 
Par contre, le temps restant ne marche pas. J'ai pas les infos nécessaires pour le faire marcher. Faites comme vous voulez pour ca.
 
Et merci Taz pour le squelette, c'était bien utile.


---------------
A savoir : la dimension de Hausdorff du chou-fleur a été calculée et vaut 2.33
n°918383
o-0-o
Posté le 01-06-2007 à 11:47:04  profilanswer
 

allez ca faisait longtemps :-)
http://membres.lycos.fr/ph4l3n3/prompt3.png

Code :
  1. function precmd {
  2. # echo -n "2;$LOGNAME@$(hostname): $(pwd)\a"
  3. if [ "$TERM" = "screen-w" ] ; then
  4. #    perl ~/bin/screen_hardstatus.pl $MYTTY $USER $HOST &!
  5. #   PROMPT=$(perl ~/bin/screen_hardstatus.pl " " $USER $HOST $ZSH_VERSION)
  6.    apm=$(apm|sed -e 's/%/%%/')
  7.    PROMPT="${green}$(uptime) $nocolor
  8. ${white_on_blue}--INSERT--${cyan}  zsh version: $ZSH_VERSION $yellow Return Code: %? $nocolor
  9. $blue%h $red%n@%m ${yellow}TTY:%l$cyan - $apm
  10. $cyan%~>$nocolor "
  11.    # PROMPT="$PROMPT$WHO\n"
  12. #  fi
  13.     case "$jobstates" in
  14.     (*running*suspended*)
  15.       psvar[1]="There are running and stopped jobs.";;
  16.     (*suspended*running*)
  17.       psvar[1]="There are running and stopped jobs.";;
  18.     (*suspended*)
  19.       psvar[1]="There are stopped jobs.";;
  20.     (*running*)
  21.       psvar[1]="There are running jobs.";;
  22.     (*)
  23.       psvar[1]="";;
  24.     esac
  25. }


---------------
pouet !
n°918393
wedgeant
Da penguin inside
Posté le 01-06-2007 à 11:55:32  profilanswer
 

[wedge@chimaera ~]$


 
[:cerveau chrisbk]


Message édité par wedgeant le 01-06-2007 à 11:55:55

---------------
Wedge#2487 @HS -#- PW: +∞ -#- Khaz-Modan/Boltiz @WoW
n°918399
Xavier_OM
Monarchiste régicide (fr quoi)
Posté le 01-06-2007 à 11:59:08  profilanswer
 

http://img530.imageshack.us/img530/7004/totoxi9.png
 
Normal et root, le root est mon ancien prompt user mais j'ai pas encore mis le nouveau partout, et en fait 2 brols différents c'est pas plus mal :o
 
 
edit :
Normal sous bash :

RESET_COLOR="\[\033[0;00m\]"
 
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
BROWN="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
PURPLE="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"
LIGHT_GRAY="\[\033[0;37m\]"
DARK_GRAY="\[\033[1;30m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
YELLOW="\[\033[1;33m\]"
LIGHT_BLUE="\[\033[1;34m\]"
LIGHT_PURPLE="\[\033[1;35m\]"
LIGHT_CYAN="\[\033[1;36m\]"
WHITE="\[\033[1;37m\]"
 
TTY=`tty`
 
PS1="$WHITE($LIGHT_GREEN\u$LIGHT_GRAY@$GREEN\h$WHITE)-$LIGHT_GRAY($CYAN$TTY$LIGHT_GRAY)-($RED\t `date "+%a %d %b"`$LIGHT_GRAY)$WHITE  
  ($BROWN\w/$WHITE)$RESET_COLOR  "



Message édité par Xavier_OM le 04-06-2007 à 18:30:41

---------------
Il y a autant d'atomes d'oxygène dans une molécule d'eau que d'étoiles dans le système solaire.
n°918400
Fork Bomb
Obsédé textuel
Posté le 01-06-2007 à 11:59:36  profilanswer
 

ishido@inferno:~$


---------------
Décentralisons Internet-Bépo-Troll Bingo - "Pour adoucir le mélange, pressez trois quartiers d’orange !"
n°918426
RiderCrazy
Posté le 01-06-2007 à 12:39:36  profilanswer
 

(remy@server ~)


 
[:cerveau dawa2]

n°918459
o-0-o
Posté le 01-06-2007 à 13:33:36  profilanswer
 

quand vous avez des prompts subtils, n'hesitez pas a mettre le code :-)

n°918460
wedgeant
Da penguin inside
Posté le 01-06-2007 à 13:35:07  profilanswer
 

o-0-o a écrit :

quand vous avez des prompts subtils, n'hesitez pas a mettre le code :-)


Code :
  1. PS1=$


 
[:cerveau merdocu]


---------------
Wedge#2487 @HS -#- PW: +∞ -#- Khaz-Modan/Boltiz @WoW
n°919321
o-0-o
Posté le 04-06-2007 à 18:03:02  profilanswer
 
n°919326
Xavier_OM
Monarchiste régicide (fr quoi)
Posté le 04-06-2007 à 18:31:11  profilanswer
 

J'ai édité mon post pour rajouter ma config :o


---------------
Il y a autant d'atomes d'oxygène dans une molécule d'eau que d'étoiles dans le système solaire.
n°919397
P-Y
Posté le 04-06-2007 à 23:07:16  profilanswer
 

Le path a gauche, c'est le mal :o
 
voila a quoi ressemble le mien


[py@pegase] $                                                                                 ~/


 
rien de bien extraordinaire, en fait le truc qui se voit pas ici c'est le hostname qui change de couleur en fonction du load average :p
et il ya aussi l'affichage du code de retour a droite du path si different de 0.
voici le code correspondant pour zsh, avec remise a jour toutes les minutes.
 
 
PERIOD=60
function periodic {
 
 
GRY='%{%}'
RED='%{%}'
GRN='%{%}'
YLW='%{%}'
BLU='%{%}'
PUR='%{%}'
CYA='%{%}'
WHT='%{%}'
 
THRESOLD=10
ONE=`uptime | sed -e "s/.*load.*: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g"`
LOAD_LEVEL=$(echo -e "scale=0 \n $ONE/0.01 \nquit \n" | bc)
LOAD_LEVEL=$(( $LOAD_LEVEL / $THRESOLD ))
if [ $LOAD_LEVEL -le 2 ];then
    MCOL=$GRN
elif [ $LOAD_LEVEL -le 4 ];then
          MCOL=$CYA
     elif [ $LOAD_LEVEL -le 6 ];then
               MCOL=$BLU
          elif [ $LOAD_LEVEL -le 8 ];then
                    MCOL=$YLW
               elif [ $LOAD_LEVEL -le 10 ];then
                         MCOL=$RED
                    else MCOL=$GRY
fi
 
if [ $UID -ne 0 ]; then
    UCOL=$WHT # simple user
    P='$'
else
    UCOL=$RED # root
    P='#'
fi
 
PS1=$YLW'%B['$UCOL'%n'$RED'@'$MCOL'%M'$YLW'] %b'$YLW$P$WHT' '
RPS1=$CYA'%~ %B%(?,,'$RED'[%?])%b'$WHT # right prompt
 
PS2=$PUR'>> '$WHT # used for multi-line command (e.g. "cat <<" )
PS3=$PUR'?# '$WHT # used in a "select" loop
PS4=$PUR'+ '$WHT # execution trace prompt
}
 
bon pour les couleurs il y aurait clairement moyen de faire plus propre et plus "portable", mais j'ai la flemme :p
 
edit: si ca marche pas, verifiez que vous avez bien bc d'installe.


Message édité par P-Y le 04-06-2007 à 23:10:58
n°919428
Gf4x3443
Killing perfection
Posté le 05-06-2007 à 00:29:09  profilanswer
 

wedgeant a écrit :

Code :
  1. PS1=$


 
[:cerveau merdocu]


 
...
 

Code :
  1. PS1='\$'


 
Mieux  :jap:

n°919956
supfrs31
Grettings Pr falken.
Posté le 06-06-2007 à 13:21:54  profilanswer
 

J'utilise le classique (au boulot aussi d'ailleurs)

blx(root/root)[PREC]/root>echo $PS1
\e[0;33m${SITE}(root/$LOGNAME)[${ORACLE_SID}]${PWD}\e[0;0m>
blx(root/root)[PREC]/root>


promptcoloré et commandes en blanc....


Message édité par supfrs31 le 06-06-2007 à 13:22:24

---------------
Merci @+
mood
Publicité
Posté le   profilanswer
 

 Page :   1  2
Page Précédente

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Divers

  vos plus beaux prompts

 

Sujets relatifs
quel logiciel pour avoir un beaux bureau????[ QT / GTK2+' ] Une histoire de pixmap ? de beaux themes
[bootsplash] ou en trouver des beaux ?? 
Plus de sujets relatifs à : vos plus beaux prompts


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)