PLEASE NOTE: this server,, will be unavailable on Wednesday 7th December, from 1pm until 4pm (was Monday 5th).
Web-based programs, such as csmarks, cssubmit, and the help fora, will all be unavailable.
  It's UWAweek 49


This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying selected article
Showing 1 of 919 articles.
Currently 48 other people reading this forum.

 UWA week 31 (2nd semester, week 2) ↓
SVG not supported

Login to reply

7:35am Sat 6th Aug, Christopher M.

"Cody Howe" <22*7*6*[email protected]*u*e*t*u*a*e*u*a*> wrote:
> Was wondering how to implement your "vc" command that you use to open a C template in vim.
Oops, forgot that one. There's multiple ways to create new commands for your shell to execute: - shell aliases - usually single-line commands kept in the shell's memory - shell functions - usually multi-line commands kept in the shell's memory - shellscripts - usually multi-line commands stored in a text file on disk My "vc" command is a function, which is stored in a disk file and read by the shell each time the shell starts. Firstly, determine if you're using bash (probably on Linux), or using zsh (probably on macOS): prompt> echo $SHELL then, based on which shell you're using, append the following text to either ~/.bashrc (for bash) or ~/.zshrc (for zsh) :
vc () {
if [ ! -r try.c ]
cat << END_END > try.c
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[])

    return 0;
vim +8 try.c
Now, exit the current shell, or start a new shell (or a new terminal window), and the new "vc" command should be found by your shell - creating a new file try.c, if necessary, and placing you in vim.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy