echo

Unwanted empty lines using echo and cat [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-25 06:29:11
问题 This question already has answers here : Unwanted line break using echo and cat (3 answers) How to insert a text at the beginning of a file? (15 answers) Closed 5 years ago . I want to add a line to the beginning of a text file. I have input.txt: line1 line2 line3 and want to add the line 'time/F:x1:x2' to end up with time/F:x1:x2 line1 line2 line3 I'm trying to do this with echo 'time/F:x1:x2' | cat - input.txt>output.txt but what I get is time/F:x1:x2 line1 line2 line3 that is, I get empty

Why does echo $$ return a number? [duplicate]

落爺英雄遲暮 提交于 2019-12-25 04:23:06
问题 This question already has answers here : What are the special dollar sign shell variables? (4 answers) Closed 5 years ago . Why do I get a number when doing that : echo $$ which returns 489 If I open a new terminal it returns another number. It seems it's related to the pid of the terminal session, but why ? 回答1: $$ means your current PID. As seen in Bash Reference Manual - 3.4.2 Special Parameters: $ Expands to the process ID of the shell. In a () subshell, it expands to the process ID of

Echo inside and Echo

你离开我真会死。 提交于 2019-12-25 04:17:31
问题 I'm using echo to sum up the results form a Table. Inside this echo, I place another echo to show all the results form another table. On this page I have an array, I want every item in that array, that is also in the result from the table, to be checked. I use the code below (remember: this code is inside another echo!), it's not functioning, why not? <?php $query = "SELECT * FROM profilestemp"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){

Echo | gives me an error [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-25 04:10:57
问题 This question already has answers here : batch echo pipe symbol causing unexpected behaviour (4 answers) Closed 3 years ago . So I have this code: echo unknown command: %2. Usage: firefox /del [history|cookies] it gives me: "cookies]" is not a internal or external command, operable program or batch file. I understand why it gives me this error, but i don't know how to fix it. any ideas? 回答1: Just so this has an official answer: The symbol | in batch is the pipe symbol. Therefore it has to be

Laravel Echo and whisper

假如想象 提交于 2019-12-25 03:12:03
问题 I'm running echo server and redis. Private channels work perfectly, and messaging I have built for it works. Now I'm trying to get the whisper to work for the typing status as well but no luck. Does whisper require a pusher to work? What I have tried on keyup (jquery) Echo.private(chat- + userid) .whisper('typing',{e: 'i am is typing...'}); console.log('key up'); // this one works so the keyup is triggered then I'm of course listening the channel what I am whispering into: Echo.private(chat-

Linux Bash Shell字符串截取

为君一笑 提交于 2019-12-25 03:08:36
#!/bin/bash #定义变量赋值时等号两边不能有空格,否则会报命令不存在 # 运行shell脚本两种方式 # 1、作为解释参数 /bin/sh test.sh ; 2、作为可执行文件 chmod +x ./test.sh blog_url='http://www.cnblogs.com/Bighua/p/7535900.html' # 1、 #号截取,从左往右删除从0开始到第一个匹配条件('//')部分,保留剩下部分 echo ${blog_url#*//} #运行结果 如下 www.cnblogs.com/Bighua/p/7535900.html #2、 ##号截取,从左往右删除从0开始到最后一个匹配条件('/')部分,保留剩下部分 echo ${blog_url##*/} #运行结果如下 7535900.html #3、 %号截取,从右往左删除从#blog_url开始到第一个匹配条件('/')部分,保留剩下部分 echo ${blog_url%/*} # 运行结果如下 http://www.cnblogs.com/Bighua/p #4、 %%号截取,从右往左删除从#blog_url开始到最后一个匹配条件('/')部分,保留剩下部分 echo ${blog_url%%/*} # 运行结果如下 http: #5、从左边第几个开始截取几个字符 echo ${blog_url

Basic echo server, client-server relationship

岁酱吖の 提交于 2019-12-25 03:05:12
问题 So as my project I had to write a client class and a simple server class that will ECHO message written by the client. For some reason I either get I/O exception or a loop of exceptions that socket's closed. I would really appreciate some help, because I struggle with this program for 2 days straight and cannot find any solutions. My Server class: import java.io.*; import java.net.*; import java.util.regex.Pattern; public class SimpleServer { private ServerSocket ss = null; private

How to echo message if no row count

风流意气都作罢 提交于 2019-12-25 02:22:11
问题 I am trying to echo the message 'No records found' when I get nothing back from the database. I have done a row count which shows me how many rows I have but I can't seem to echo the 'No records found' message. Is it in the wrong place? Will it not run for some reason? <?php if(isset($search_results)){ foreach($search_results as $result) { $rowcount = $result['rowcount']; if(!$rowcount < 1) { echo $rowcount; echo '<div class="search_result"> <b>'.$result['title'].'</b><br />'; echo '<span

wp_title() return value can't be styled [closed]

巧了我就是萌 提交于 2019-12-25 02:06:37
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . The title is displayed before my image and is not styled. How to fix it? $tytul = wp_title(); echo '<img class="icon" src="http://site.pl/site/icon.png"

Batch - How to Echo %%Variable%%

北城以北 提交于 2019-12-25 01:46:27
问题 I have a small problem with a batch file I'm working on. Here's a simple sample: I would like to get the string "THERE" as my result. But the result I get is just "HELLO" set hello=there set a=h set b=ello set result=%a%%b% echo %result% I already tried something like this: Echo %%result%% And Sadly, it just gets me the result %HELLO% Any help would be great. Thanks! 回答1: The reason that %%result%% gives you %result% on the output is that the %% tokens are interpreted first, and further