Remote IT Support!! Please contact us

For Any Remote Support,Implementation/Upgrade Projects,Queries,Collaborations please mail us at support@funoracleapps.com

YES command in Linux

No comments

YES command in Linux


Yes command prints the same string continuously on output. If no string is given it will print y.
To cancel print press Cntrl+C

Syntax:

yes [String]


Example:

[himanshu@oel7 ~]$ yes "Himanshu"
Himanshu
Himanshu
Himanshu
Himanshu
Himanshu
Himanshu
^C
[himanshu@oel7 ~]$ yes
y
y
y
y
y
y
^C


Where can I use it in real-time??

Let's say I want to some input regularly to a command, I can use 


I am running rm -i and don't want to give no to remove any file, I have used "yes n"
[himanshu@oel7 AWK]$ yes n |rm -i *
rm: remove regular file ‘2d-array’? rm: remove regular file ‘arit_func’? rm: remove regular file ‘array_file’? rm: remove regular file ‘array_food’? rm: remove regular file ‘builtin_arry_var’? rm: remove regular file ‘com’? rm: remove regular file ‘command_file’? rm: remove regular file ‘Employee_Data.csv’? rm: remove regular file ‘Employee_Data.csv_blankline’? rm: remove regular file ‘Employee_Data.txt’? rm: remove regular file ‘multi_array’? rm: remove regular file ‘newfile’? rm: remove regular file ‘random_file.txt’? rm: remove regular file ‘random_funtion’? rm: remove regular file ‘return_average_func’? rm: remove regular file ‘split_array’? rm: remove regular file ‘string_function’? rm: remove regular file ‘transpose_array’? rm: remove regular file ‘user_function’? [himanshu



If you like please follow and comment

No comments :

Post a Comment