اطلاعیه

بستن
هنوز اطلاعیه ای در دست نیست.

تغییر promptbash به فرمت ویندوز

بستن
X
 
  • فیلتر کردن
  • زمان
  • نمایش
Clear All
پست های جدید

    تغییر promptbash به فرمت ویندوز

    با تغییر متغیر PS1 که مخفف Primary Shell 1 می باشد می توان promptbash را به فرمت دلخواه تغییر داد و اگر به صورت زیر آن را عوض کنیم همانند prompt سیستم عامل DOS یا ویندوز می شود که امتحان کردن آن خالی از لطف نیست :

    کد PHP:
                PS1='C:${PWD////\} >' 

    Instagram : https://www.instagram.com/iranlinuxforum

    Voip Trainer - Asterisk - Elastix - Agi Programming- NewRock

    Voip & Linux Trainer
    kamailio-freeswitch-Asterisk-Issabel-fusion-Programming
    Newrock-Sangoma-Digium-Openvox-Synway-Atcom-Quintum Tenor-Polycom-Yealink-Snom-yeastar-grandstream
    Cisco Collaboration - CME-CUCM-CUPs-CUC-WEBEX
    ZABBIX-VOIPMONITOR
    Linux-Devops

    Linkedin Profile : https://www.linkedin.com/in/masuma-vahid-26b17b66/

    #2
    سلام
    یه مقدار بیشتر توضیح میدید یعنی چی این دستور ؟ به چه کاری میاد؟

    کامنت


      #3
      دوباره سلام
      خط prompt شما توی لینوکس به این صورته دیگه :
      کد PHP:
                  [root@vahid ~] 
      این ساختار توی یه متغیر ذخیره میشه به نام PS1
      برا دیدن مقدار فعلی متغیر :
      کد PHP:
                  echo $PS1 

      خروجی کامند بالا که زدین باید یه چنین چیزی باشه:

      کد PHP:
                  [\u@\h \W]\$ 
      برا اینکه به صورت خط prompt ویندوزی در بیاد متغیرPS1 رو برابر با مقداری که قبلا گفتم بذارید

      شاید اصلا بخواین یه شکل دیگه باشه مثلا به جای :

      کد PHP:
                  [root@vahid ~] 
      اینجوری باشه:
      کد PHP:
                  [Sat Jun 02 14:24:12 vivek@server:~ ] 
      حالا باید متغیر رو برابر با:

      کد PHP:
                  PS1="[\d \t \u@\h:\w ] 
      لیست کامل گزینه هاش رو براتون میذارم

      Instagram : https://www.instagram.com/iranlinuxforum

      Voip Trainer - Asterisk - Elastix - Agi Programming- NewRock

      Voip & Linux Trainer
      kamailio-freeswitch-Asterisk-Issabel-fusion-Programming
      Newrock-Sangoma-Digium-Openvox-Synway-Atcom-Quintum Tenor-Polycom-Yealink-Snom-yeastar-grandstream
      Cisco Collaboration - CME-CUCM-CUPs-CUC-WEBEX
      ZABBIX-VOIPMONITOR
      Linux-Devops

      Linkedin Profile : https://www.linkedin.com/in/masuma-vahid-26b17b66/

      کامنت


        #4
        مثلا اگه بزنید:
        کد PHP:
                    PS1="\d \h $ " 
        نتیجه اینکه خط prompt شما به صورت زیر در میاد:

        کد PHP:
                    Sat Jun 02 server $ 
        اینا optionهایی هستند که میتونید استفاده کنید

        کد PHP:
          \a : an ASCII bell character (07)
            
        \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
            
        \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
            \e 
        : an ASCII escape character (033)
            
        \h : the hostname up to the first '.'
            
        \H : the hostname
            \j 
        : the number of jobs currently managed by the shell
            \l 
        : the basename of the shell’s terminal device name
            \n 
        : newline
            \r 
        : carriage return
            
        \s : the name of the shell, the basename of $0 (the portion following the final slash)
            
        \t : the current time in 24-hour HH:MM:SS format
            \T 
        : the current time in 12-hour HH:MM:SS format
            
        \@ : the current time in 12-hour am/pm format
            \A 
        : the current time in 24-hour HH:MM format
            \u 
        : the username of the current user
            \v 
        : the version of bash (e.g., 2.00)
            
        \V : the release of bash, version + patch level (e.g., 2.00.0)
            
        \w : the current working directory, with $HOME abbreviated with a tilde
            \W 
        : the basename of the current working directory, with $HOME abbreviated with a tilde
            
        \! : the history number of this command
            
        \# : the command number of this command
            
        \$ : if the effective UID is 0, a #, otherwise a $
            
        \nnn : the character corresponding to the octal number nnn
            
        \\ : a backslash
            
        \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
            
        \] : end a sequence of non-printing characters 
        موفق باشید

        Instagram : https://www.instagram.com/iranlinuxforum

        Voip Trainer - Asterisk - Elastix - Agi Programming- NewRock

        Voip & Linux Trainer
        kamailio-freeswitch-Asterisk-Issabel-fusion-Programming
        Newrock-Sangoma-Digium-Openvox-Synway-Atcom-Quintum Tenor-Polycom-Yealink-Snom-yeastar-grandstream
        Cisco Collaboration - CME-CUCM-CUPs-CUC-WEBEX
        ZABBIX-VOIPMONITOR
        Linux-Devops

        Linkedin Profile : https://www.linkedin.com/in/masuma-vahid-26b17b66/

        کامنت

        در حال انجام ...
        X