-1

We have to make a script that interacts with the standard input, wich is a file and we put a keystring on it, but the difficulty of this exercise is that the file can't be found in some cases, so we have to save the filename to a variable

key.sh (keystring) < (filename)

how can i save the filename into a variable?

leppie
  • 115,091
  • 17
  • 196
  • 297
fangio
  • 1,746
  • 5
  • 28
  • 52

1 Answers1

0

In key.sh, you want to have a script like this:

#!/bin/sh

# assign the input string to the variable filename
filename="$1"

Then you would actually call the script with key.sh filename

jan
  • 336
  • 1
  • 4