echo

“Command not found” piping a variable to cut when output stored in a variable [duplicate]

谁说我不能喝 提交于 2021-02-16 20:17:16
问题 This question already has answers here : How to pass the value of a variable to the stdin of a command? (9 answers) Closed 3 years ago . In a bash script I am using a variable to hold a path like this: MY_DIR=/just/a/string/to/my/path And I want to remove the last two parts of it so it looks like this: /just/a/string I am using 'cut' to do it, like this: echo $MY_DIR | cut -d'/' -f-4 The output is what I expect. Fine. But I want to store in an other variable, like this: MY_DIR2=$($MY_DIR |

split array values into different divs

。_饼干妹妹 提交于 2021-02-11 15:20:53
问题 I have a php array generated by Advanced custom field. here is my php code: <?php $rows = get_field('nous_suivre',11 ); // get all the rows print_r($rows) ?> when I print_r my array, here is what I get: Array ( [0] => Array ( [nom] => Facebook [lien] => http://www.facebook.com/ID ) [1] => Array ( [nom] => Twitter [lien] => http://www.twitter.com/ID ) [2] => Array ( [nom] => Instagram [lien] => http://www.instagram.com/ID ) ) what I'm trying to do is to split my array content into separate

how to echo text containing with double quotes [duplicate]

孤街浪徒 提交于 2021-02-10 12:47:29
问题 This question already has answers here : How can I escape a double quote inside double quotes? (8 answers) Difference between single and double quotes in Bash (6 answers) Closed 2 months ago . I need to echo some text. like text "hey" If i try with code echo "text "hey"" getting output as text hey So, how to display the double quotes also. Can anyone help me with this. 回答1: You can use echo 'text "hey"' or echo "text \"hey\"" In short: The double quote ( "quote" ) protects everything enclosed

Using double quotes in Applescript command Do Shell Script Echo

梦想的初衷 提交于 2021-02-10 05:13:48
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

我们两清 提交于 2021-02-10 05:12:37
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

谁说胖子不能爱 提交于 2021-02-10 05:08:49
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

谁都会走 提交于 2021-02-10 05:05:58
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Echo -n With String argument printing the “-n” part, even though not within quotation marks

橙三吉。 提交于 2021-02-08 16:42:16
问题 I've been learning how to script in bash, but I'm coming across a frustrating bug. In the below code, which just runs to print 10 rows and ten with ten columns, whenever the echo -n "$j " runs, the output prints out both a new line and the "-n" argument to the echo command. The echo command and the echo -n both work perfectly fine on their own, but for some reason, don't work within this script... Thank you in advance #Nested for loop for i in 1 2 3 4 5 6 7 8 9 10 do echo -n "Row $i: " for j

Echo -n With String argument printing the “-n” part, even though not within quotation marks

拈花ヽ惹草 提交于 2021-02-08 16:41:37
问题 I've been learning how to script in bash, but I'm coming across a frustrating bug. In the below code, which just runs to print 10 rows and ten with ten columns, whenever the echo -n "$j " runs, the output prints out both a new line and the "-n" argument to the echo command. The echo command and the echo -n both work perfectly fine on their own, but for some reason, don't work within this script... Thank you in advance #Nested for loop for i in 1 2 3 4 5 6 7 8 9 10 do echo -n "Row $i: " for j

How to automatically hit Enter in bash script when asked?

妖精的绣舞 提交于 2021-02-07 14:50:31
问题 I know that this question is answered many times, but I still can't figure out how to do it. Maybe it's because I don't know the correct keyword to search for. Using echo -ne '\n' | enter doesn't work. My code is: #! /bin/bash #Grub-customizer sudo add-apt-repository ppa:danielrichter2007/grub-customizer echo -ne '\n' | return sudo apt-get update sudo apt-get install grub-customizer 回答1: You're supposed to pipe the \n into the command that's going to be receiving it (otherwise it won't ever