Junos OS

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



Expand all | Collapse all

get switchname as variable

  • 1.  get switchname as variable

    Posted 08-16-2021 09:04

    Hello,

     

                   I am looking for a quick way to do the following:

    ·        This is my switch..... root@mrct-nddn-02- >

    ·        This is a text file on my switch ..... testData

    ·        I want to issue a Junos or Linux command to do the following:  rename "testdata" as "mrct-nddn-02_testData"

     

    Is there a quick Junos or Linux way to get my switch name and append it to the file name ?

     

    Thanks

    Michel lapointe



  • 2.  RE: get switchname as variable

     
    Posted 08-16-2021 14:39
    root@switch:RE:0% touch test
    root@switch:RE:0% mv test test-`hostname`
    root@switch:RE:0% ls -la test*
    -rw-r--r-- 1 root wheel 0 Aug 16 18:26 test-switch



  • 3.  RE: get switchname as variable

    Posted 08-17-2021 05:30
    simple, and to the point. Thank you
    Michel

    ------------------------------
    Michel Lapointe
    ------------------------------