Index: shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
===================================================================
--- shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java	(revision 1498644)
+++ shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java	(working copy)
@@ -18,17 +18,48 @@
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.AbstractAction;
+import org.apache.karaf.util.StreamUtils;
 
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+
 @Command(scope = "shell", name = "alias", description = "Create an alias to a command")
 public class AliasAction extends AbstractAction {
 
     @Argument(index = 0, name = "command", description = "The command to alias, e.g. 'ldn = { log:display -n $args }'", required = true, multiValued = false)
     private String alias;
 
+    @Option(name = "--persist", aliases = "-p", valueToShowInHelp = "false", description = "Add this flag to persist the alias in ${karaf.home}/etc/shell.init.script")
+    private boolean persist;
+
     protected Object doExecute() throws Exception {
         session.execute(alias);
+
+        if (persist) {
+            String karafHome = session.get("karaf.home").toString();
+            // just append the alias part, not the actual alias command too
+            // it is not available when evaluating the shell.init.script file in ConsoleImpl
+            appendToFile(new File(karafHome, "etc/shell.init.script"), alias + " ;");
+        }
+
         return null;
     }
 
+    private void appendToFile(File file, String line) throws IOException {
+        OutputStreamWriter writer = null;
+        try {
+            writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file, true)));
+            writer.write("\n" + line);
+        } finally {
+            if (writer != null) {
+                StreamUtils.close(writer);
+            }
+        }
+    }
+
 }
