码迷,mamicode.com
首页 > 系统相关 > 详细

Linux下创建shell、C小程序介绍

时间:2017-08-30 09:56:16      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:exit   二进制   生成   span   介绍   bsp   printf   inux   shel   

1.创建一个shell脚本文件

gedit  hello_shell.sh  ##创建文件

2.###在文件内添加一下内容

#!/bin/bash

for  ((i=0;i<10;i++));do

  echo   "hello shell"

done

exit 0

3.为文件添加可执行权限

chmod 755 hello_shell.sh

4.执行脚本

./hello_shell.sh

 

###创建一个C语言程序"hello world"

1.gedit  hello_world.c

2.##添加一下内容

#include  <stdio.h>

int  main(void)

{

  printf("hello world!\n");

  return 0;

}

3.保存后使用gcc生成可执行文件

gcc  -o  hello_world  hello_world.c

gcc生成的二进制文件,默认具有可执行权限,不需要修改

 

Linux下创建shell、C小程序介绍

标签:exit   二进制   生成   span   介绍   bsp   printf   inux   shel   

原文地址:http://www.cnblogs.com/lmt921108/p/7451312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!