在linux中用C语音输出hello world

在linux中用C语音输出hello world,第1张

编写源代码,如下文件hello.c

#include <stdio.h>

int main()

{

printf("hello world\r\n")

return 0

}

2. 编译生成可执行程序,如gcc -W hello.c -o hello

3. 执行生成的可执行程序,如 chmod +x hello./hello

这个是无限循环的话,用bash可以这样写

#!/bin/bash

while true

do

echo "Hello, Linux!"

sleep 2

done

不知道用的什么发行版,如果有rev命令这样 *** 作比较简单:# echo "hello,world" | rev

如果没有rev命令,大都会有sed命令:# echo "Hello,world" | sed -r '/\n/!Gs/(.)(.*\n)/&\2\1///Ds/.//'


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8473402.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-16
下一篇2023-04-16

发表评论

登录后才能评论

评论列表(0条)

    保存