c - How to close a file using shell script -


i need open , close file using shell script.

myshell.sh

vi adc.c 

when execute myshell.sh, opens file.

i need close file using shell script.

what command should include in myshell.sh

i want create file using shell script. when did using 'vi' file created need manually esc+wq

vi interactive file editor. allows open/create file, edit file user interaction, , save file , quit (by esc-wq). can in shell script (some applications let user edit text), if want create file contents in batch mode, without user interaction, use like

#!/bin/bash  echo "my contents" > /path/to/local/adc.c cat /path/to/local/part-r-00000 >> /path/to/local/adc.c 

the first line creates empty file adc.c, second line appends contents of part-r-00000 file.

there no need "create" file first. done automatically shell. might want go through bash: redirection (there similar pages other shells).


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -