惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Archives - TechRepublic
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
Cisco Talos Blog
Cisco Talos Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
S
Secure Thoughts
H
Hacker News: Front Page
I
Intezer
Cyberwarzone
Cyberwarzone
T
Tor Project blog
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
T
Threatpost
T
Tenable Blog
NISL@THU
NISL@THU
AWS News Blog
AWS News Blog
阮一峰的网络日志
阮一峰的网络日志
T
Troy Hunt's Blog
E
Exploit-DB.com RSS Feed
V
Visual Studio Blog
W
WeLiveSecurity
腾讯CDC
The GitHub Blog
The GitHub Blog
T
The Exploit Database - CXSecurity.com
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX - 技术
A
Arctic Wolf
N
Netflix TechBlog - Medium
S
Securelist
WordPress大学
WordPress大学
Schneier on Security
Schneier on Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
AI
AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
Help Net Security
Help Net Security
Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
G
Google Developers Blog
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cloudbric
Cloudbric
P
Palo Alto Networks Blog

Unix

请教下关于 IO 缓冲的一点疑问 - V2EX mv 命令文件夹后面加斜杠真的没有意义吗? Plesk 镜像制作(脚本) 会有人觉得unix系的命令行工具好用的吗,相比gnu的来说 V7/x86
怎么写 Mac 下的脚本? - V2EX
hatcloud · 2014-10-25 · via Unix

这是一个创建于 4251 天前的主题,其中的信息可能已经有所发展或是发生改变。

自己想写一个自动从GitHub上更新最新的Hosts文件到本地的脚本,奈何完全不会Unix的脚本编写。
希望诸位能提供个简单教程的网页
或者直接帮我写一个吧(不会被说伸手党吧)

在终端自己输入的命令如下:
cd 本地的Git文件夹路径
git pull
sudo cp imouto.host.txt /etc/hosts

第 1 条附言  ·  2014 年 10 月 25 日

脚本写好了,果然只要吧命令行一条条列出来就行了

附上脚本内容及GitHub地址:

-------文件名---------
updateHosts.sh

-------文件内容----------
#! /bin/bash
cd /Users/Jeff/Documents/Git/imouto.host
git pull
sudo cp imouto.host.txt /etc/hosts

我在用的hosts地址:https://github.com/zxdrive/imouto.host
蛮好用的,基本Google,FB,Twitter等都不用GoAgent,VPN了

第 2 条附言  ·  2014 年 10 月 25 日

现在要做的就是把这个脚本定时运行,这个还得去查查看

  • 脚本
  • git
  • sudo

    9 条回复    2014-10-25 15:16:50 +08:00

    hjc4869

    1

    hjc4869      2014 年 10 月 25 日

    学一下bash脚本,挺容易的。

    Busy

    3

    Busy      2014 年 10 月 25 日

    三个命令写成三行,放入一个文件中,给他执行权限,不就一个脚本嘛
    看下 shell 相关的知识

    Livid

    5

    Livid      2014 年 10 月 25 日

    你可以考虑先稍微学一下 vi 编辑器。

    banbanchs

    6

    banbanchs      2014 年 10 月 25 日

    wget rawgithubXXX -O /etc/hosts
    加到crontab,要root权限

    Vicia

    8

    Vicia      2014 年 10 月 25 日

    Keyboard Maestro可以定时运行脚本。

    skydiver

    9

    skydiver      2014 年 10 月 25 日 via Android

    直接软链到/etc/hosts就行了,以后每次pull