WHCSRL 技术网

LInux环境运行C语言

运行语言

gcc -c demo.c 编译
->生成demo.o
 gcc test.o -o test
->生成可执行文件demo
./demo
->执行
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
 gcc demo.c -o demo
 ->生成可执行文件demo

  • 1
  • 2
  • 3
->运行python语言
python demo.py
->执行
  • 1
  • 2
  • 3

常用命令

1.
cat demo.txt
->获取第一行内容

cat <<EOF > test.txt
-> 创建test.txt并输入内容直至遇到EOF
---------------------------------------------------------------------
2.
echo "hello"
->显示
hello

echo "hello" > demo.txt
->创建demo.txt并写入hello

vim demo.sh
read name                 ->name是变量名    ->read等同于scanf读入
echo "$name It is a test"  
->编辑shell脚本

sh demo.sh
->运行
linux_testsh
->输入
linux_testsh It is a test
->显示


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
推荐阅读