Search code examples
shelljenkins-cli

Create a file and write data to it


I am very new to jenkins and shell scripting. I am working on a task where i have to create a file and write $[Orance.home] in it.Please let me know is there any command


Solution

  • I may be missing something, but you could do

    # replace MY_FILE.txt content with one line containing ${Orance.home}
    echo "${Orance.home}" > MY_FILE.txt
    

    or possibly,

    # Append ${Orance.home} to MY_FILE.txt
    echo "${Orance.home}" >> MY_FILE.txt
    

    Or, you might use the tee command (with our without -a)

    echo "${Orance.home}" | tee MY_FILE.txt