0

Looking for solution round this .

i have a script

a.bsh

#!/bin/bash a=5 echo $a

this prints 5 when ever executed .

./a.bsh 5

i need to either look to update this script or use another away to get value 5 when i do on console

echo $a

i tried updating .bashrc with

alias a=5

but it didnt work . Also we can use set in this somehow ?

please advice

Machine
  • 99
  • 2
  • 8
  • I'm not sure I understand your question. Is the value always 5? Do you just need a variable that holds the number 5? Why do you need a script that all it does it printing a constant number? Have you tried export a=5? – aviro Dec 13 '21 at 07:58

1 Answers1

1

If you want to echo the value which you provide via command line you can use something like:

./a.bsh 5

and the script itself:

#! /bin/sh -
printf '%s\n' "$1"

Also remember:

Romeo Ninov
  • 17,484