Question

I'm new programming in shell and I need some help with this code...

Buildname= test
echo $Buildname > lbuild
cbuild < lbuild
echo $cbuild

So echo $cbuild must display the first line in the text file created.

can someone help me with that?

Was it helpful?

Solution

Use read

read -r cbuild < filename

OTHER TIPS

I think you either want double quotes around the test in Buildname = test or there is more to the script. :-)

I took the liberty of assuming I know what you need, here's my swag at it:

    #! /bin/bash

    Buildname="test"
    echo $Buildname > lbuild
    cbuild=$(cat lbuild)
    echo $cbuild
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top