Adding double quotes at the end of string

My input is this:
Inputfile = file.txt

needs to change to,
Inputfile = file.txt"

I have tried using:
Inputfile = `echo ${Inputfile}"'

doesn't work for me.

Similarly how do I change it to all double quotes:
Inputfile = "file.txt"

Hello and welcome to the forum.

You need to escape the special char 'doublequotes' with a leading backslash.
Eg: \"
Wich would then become:

inputfile = file.txt\"
# OR
inputfile = "file.txt\""

However, i would assume that you have some quotation errors somewhere else in your script.

For the future, please use the

CO
DE 

tags to make your examples easier to read.

Hope this helps

1 Like

@bvnprasad123 and sea :

if you are defining variable then please take care about space

you might receive this error

$ Inputfile = file.txt
Inputfile: command not found

where as this is valid

$ Inputfile=file.txt
1 Like

My bad for not using code.Thanks for the help

Try like this

akshay@Aix:~$ x="file.txt"
akshay@Aix:~$ echo $x
file.txt

akshay@Aix:~$ y="\"$x"\"
akshay@Aix:~$ echo $y
"file.txt"

akshay@Aix:~$ z="$x"\"
akshay@Aix:~$ echo $z
file.txt"

---------- Post updated at 01:26 AM ---------- Previous update was at 01:20 AM ----------

I just seen you modified post #4